Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-23 04:29:19

0001 
0002 // File: SiPixelTrackingRecHitsValid.cc
0003 // Authors:  Xingtao Huang (Puerto Rico Univ.)
0004 //           Gavril Giurgiu (JHU)
0005 // Creation Date: Oct. 2006
0006 
0007 #include <memory>
0008 #include <string>
0009 #include <iostream>
0010 #include <TMath.h>
0011 #include "Validation/RecoTrack/interface/SiPixelTrackingRecHitsValid.h"
0012 
0013 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0016 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0017 #include "DataFormats/GeometryVector/interface/LocalVector.h"
0018 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0019 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0020 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0021 #include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
0022 
0023 #include "DataFormats/TrackReco/interface/Track.h"
0024 #include "DataFormats/TrackReco/interface/TrackExtra.h"
0025 #include "DataFormats/DetId/interface/DetId.h"
0026 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0027 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0028 
0029 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
0030 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0031 #include "Geometry/Records/interface/TrackerTopologyRcd.h"
0032 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0033 
0034 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0035 
0036 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0037 
0038 #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyBuilder.h"
0039 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0040 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0041 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0042 
0043 #include <TTree.h>
0044 #include <TFile.h>
0045 
0046 // End job: write and close the ntuple file
0047 void SiPixelTrackingRecHitsValid::endJob() {
0048   if (!debugNtuple_.empty()) {
0049     tfile_->Write();
0050     tfile_->Close();
0051   }
0052 }
0053 
0054 void SiPixelTrackingRecHitsValid::beginJob() {
0055   if (!debugNtuple_.empty()) {
0056     tfile_ = new TFile(debugNtuple_.c_str(), "RECREATE");
0057 
0058     t_ = new TTree("Ntuple", "Ntuple");
0059     int bufsize = 64000;
0060 
0061     t_->Branch("subdetId", &subdetId, "subdetId/I", bufsize);
0062 
0063     t_->Branch("layer", &layer, "layer/I", bufsize);
0064     t_->Branch("ladder", &ladder, "ladder/I", bufsize);
0065     t_->Branch("mod", &mod, "mod/I", bufsize);
0066     t_->Branch("side", &side, "side/I", bufsize);
0067     t_->Branch("disk", &disk, "disk/I", bufsize);
0068     t_->Branch("blade", &blade, "blade/I", bufsize);
0069     t_->Branch("panel", &panel, "panel/I", bufsize);
0070     t_->Branch("plaq", &plaq, "plaq/I", bufsize);
0071 
0072     t_->Branch("rechitx", &rechitx, "rechitx/F", bufsize);
0073     t_->Branch("rechity", &rechity, "rechity/F", bufsize);
0074     t_->Branch("rechitz", &rechitz, "rechitz/F", bufsize);
0075     t_->Branch("rechiterrx", &rechiterrx, "rechiterrx/F", bufsize);
0076     t_->Branch("rechiterry", &rechiterry, "rechiterry/F", bufsize);
0077     t_->Branch("rechitresx", &rechitresx, "rechitresx/F", bufsize);
0078     t_->Branch("rechitresy", &rechitresy, "rechitresy/F", bufsize);
0079     t_->Branch("rechitpullx", &rechitpullx, "rechitpullx/F", bufsize);
0080     t_->Branch("rechitpully", &rechitpully, "rechitpully/F", bufsize);
0081 
0082     t_->Branch("npix", &npix, "npix/I", bufsize);
0083     t_->Branch("nxpix", &nxpix, "nxpix/I", bufsize);
0084     t_->Branch("nypix", &nypix, "nypix/I", bufsize);
0085     t_->Branch("charge", &charge, "charge/F", bufsize);
0086 
0087     t_->Branch("alpha", &alpha, "alpha/F", bufsize);
0088     t_->Branch("beta", &beta, "beta/F", bufsize);
0089 
0090     t_->Branch("phi", &phi, "phi/F", bufsize);
0091     t_->Branch("eta", &eta, "eta/F", bufsize);
0092 
0093     t_->Branch("half", &half, "half/I", bufsize);
0094     t_->Branch("flipped", &flipped, "flipped/I", bufsize);
0095 
0096     t_->Branch("simhitx", &simhitx, "simhitx/F", bufsize);
0097     t_->Branch("simhity", &simhity, "simhity/F", bufsize);
0098 
0099     t_->Branch("nsimhit", &nsimhit, "nsimhit/I", bufsize);
0100     t_->Branch("pidhit", &pidhit, "pidhit/I", bufsize);
0101 
0102     t_->Branch("evt", &evt, "evt/I", bufsize);
0103     t_->Branch("run", &run, "run/I", bufsize);
0104   }
0105 }
0106 
0107 SiPixelTrackingRecHitsValid::SiPixelTrackingRecHitsValid(const edm::ParameterSet& ps)
0108     : tTopoEsToken_(esConsumes()),
0109       tGeomEsToken_(esConsumes()),
0110       trackerHitAssociatorConfig_(ps, consumesCollector()),
0111       dbe_(nullptr),
0112       tfile_(nullptr),
0113       t_(nullptr) {
0114   //Read config file
0115   MTCCtrack_ = ps.getParameter<bool>("MTCCtrack");
0116   runStandalone = ps.getParameter<bool>("runStandalone");
0117   outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "pixeltrackingrechitshisto.root");
0118   siPixelRecHitCollectionToken_ = consumes<SiPixelRecHitCollection>(edm::InputTag("siPixelRecHits"));
0119   recoTrackCollectionToken_ =
0120       consumes<reco::TrackCollection>(edm::InputTag(ps.getUntrackedParameter<std::string>("src")));
0121   builderName_ = ps.getParameter<std::string>("TTRHBuilder");
0122   checkType_ = ps.getParameter<bool>("checkType");
0123   genType_ = ps.getParameter<int>("genType");
0124   debugNtuple_ = ps.getUntrackedParameter<std::string>("debugNtuple", "SiPixelTrackingRecHitsValid_Ntuple.root");
0125 }
0126 
0127 void SiPixelTrackingRecHitsValid::bookHistograms(DQMStore::IBooker& ibooker,
0128                                                  const edm::Run& run,
0129                                                  const edm::EventSetup& es) {
0130   // Book histograms
0131   dbe_ = edm::Service<DQMStore>().operator->();
0132 
0133   //float math_pi = 3.14159265;
0134   //float radtodeg = 180.0 / math_pi;
0135 
0136   // Histogram ranges (low and high)
0137 
0138   float xl = -1.0;
0139   float xh = 1.0;
0140   float errxl = 0.0;
0141   float errxh = 0.003;
0142   float resxl = -0.02;
0143   float resxh = 0.02;
0144   float pullxl = -10.0;
0145   float pullxh = 10.0;
0146 
0147   float yl = -4.0;
0148   float yh = 4.0;
0149   float erryl = 0.0;
0150   float erryh = 0.010;
0151   float resyl = -0.04;
0152   float resyh = 0.04;
0153   float pullyl = -10.0;
0154   float pullyh = 10.0;
0155 
0156   float barrel_alphal = 80.0;
0157   float barrel_alphah = 100.0;
0158   float barrel_betal = 10.0;
0159   float barrel_betah = 170.0;
0160   //float barrel_phil = -180.0;
0161   //float barrel_phih =  180.0;
0162   //float barrel_etal = -2.5;
0163   //float barrel_etah =  2.5;
0164 
0165   float forward_p1_alphal = 100.0;
0166   float forward_p1_alphah = 115.0;
0167   float forward_p2_alphal = 65.0;
0168   float forward_p2_alphah = 80.0;
0169   float forward_neg_betal = 67.0;
0170   float forward_neg_betah = 73.0;
0171   float forward_pos_betal = 107.0;
0172   float forward_pos_betah = 113.0;
0173   //float forward_phil = -180.0;
0174   //float forward_phih =  180.0;
0175   //float forward_neg_etal = -2.5;
0176   //float forward_neg_etah = -1.5;
0177   //float forward_pos_etal = 1.5;
0178   //float forward_pos_etah = 2.5;
0179 
0180   // special ranges for pulls
0181   float pull_barrel_alphal = 80.0;
0182   float pull_barrel_alphah = 100.0;
0183   float pull_barrel_betal = 10.0;
0184   float pull_barrel_betah = 170.0;
0185   float pull_barrel_phil = -180.0;
0186   float pull_barrel_phih = 180.0;
0187   float pull_barrel_etal = -2.4;
0188   float pull_barrel_etah = 2.4;
0189 
0190   float pull_forward_p1_alphal = 100.0;
0191   float pull_forward_p1_alphah = 112.0;
0192   float pull_forward_p2_alphal = 68.0;
0193   float pull_forward_p2_alphah = 80.0;
0194   float pull_forward_neg_betal = 68.0;
0195   float pull_forward_neg_betah = 72.0;
0196   float pull_forward_pos_betal = 108.0;
0197   float pull_forward_pos_betah = 112.0;
0198   float pull_forward_phil = -180.0;
0199   float pull_forward_phih = 180.0;
0200   float pull_forward_neg_etal = -2.4;
0201   float pull_forward_neg_etah = -1.4;
0202   float pull_forward_pos_etal = 1.5;
0203   float pull_forward_pos_etah = 2.5;
0204 
0205   int npixl = 0;
0206   int npixh = 20;
0207   int nxpixl = 0;
0208   int nxpixh = 10;
0209   int nypixl = 0;
0210   int nypixh = 20;
0211 
0212   float barrel_chargel = 0.0;
0213   float barrel_chargeh = 250000.0;
0214   float forward_chargel = 0.0;
0215   float forward_chargeh = 100000.0;
0216 
0217   ibooker.setCurrentFolder("Tracking/TrackingRecHits/Pixel/Histograms_per_ring-layer_or_disk-plaquette");
0218 
0219   // Pixel barrel has 3 layers and 8 rings; book a histogram for each module given by the (layer, ring) pair
0220   for (int i = 0; i < 3; i++)  // loop over layers
0221   {
0222     Char_t chisto[100];
0223 
0224     sprintf(chisto, "meResxBarrelLayer_%d", i + 1);
0225     meResxBarrelLayer[i] = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0226     sprintf(chisto, "meResyBarrelLayer_%d", i + 1);
0227     meResyBarrelLayer[i] = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0228     sprintf(chisto, "mePullxBarrelLayer_%d", i + 1);
0229     mePullxBarrelLayer[i] = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0230     sprintf(chisto, "mePullyBarrelLayer_%d", i + 1);
0231     mePullyBarrelLayer[i] = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0232 
0233     sprintf(chisto, "meResXvsAlphaBarrelFlippedLaddersLayer_%d", i + 1);
0234     meResXvsAlphaBarrelFlippedLaddersLayer[i] =
0235         ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
0236     sprintf(chisto, "meResYvsAlphaBarrelFlippedLaddersLayer_%d", i + 1);
0237     meResYvsAlphaBarrelFlippedLaddersLayer[i] =
0238         ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
0239     sprintf(chisto, "meResXvsBetaBarrelFlippedLaddersLayer_%d", i + 1);
0240     meResXvsBetaBarrelFlippedLaddersLayer[i] =
0241         ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
0242     sprintf(chisto, "meResYvsBetaBarrelFlippedLaddersLayer_%d", i + 1);
0243     meResYvsBetaBarrelFlippedLaddersLayer[i] =
0244         ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");
0245 
0246     sprintf(chisto, "meResXvsAlphaBarrelNonFlippedLaddersLayer_%d", i + 1);
0247     meResXvsAlphaBarrelNonFlippedLaddersLayer[i] =
0248         ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
0249     sprintf(chisto, "meResYvsAlphaBarrelNonFlippedLaddersLayer_%d", i + 1);
0250     meResYvsAlphaBarrelNonFlippedLaddersLayer[i] =
0251         ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
0252     sprintf(chisto, "meResXvsBetaBarrelNonFlippedLaddersLayer_%d", i + 1);
0253     meResXvsBetaBarrelNonFlippedLaddersLayer[i] =
0254         ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
0255     sprintf(chisto, "meResYvsBetaBarrelNonFlippedLaddersLayer_%d", i + 1);
0256     meResYvsBetaBarrelNonFlippedLaddersLayer[i] =
0257         ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");
0258 
0259     for (int j = 0; j < 8; j++)  // loop over rings
0260     {
0261       sprintf(chisto, "mePosxBarrelLayerModule_%d_%d", i + 1, j + 1);
0262       mePosxBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, xl, xh);
0263       sprintf(chisto, "mePosyBarrelLayerModule_%d_%d", i + 1, j + 1);
0264       mePosyBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, yl, yh);
0265       sprintf(chisto, "meErrxBarrelLayerModule_%d_%d", i + 1, j + 1);
0266       meErrxBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0267       sprintf(chisto, "meErryBarrelLayerModule_%d_%d", i + 1, j + 1);
0268       meErryBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0269       sprintf(chisto, "meResxBarrelLayerModule_%d_%d", i + 1, j + 1);
0270       meResxBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0271       sprintf(chisto, "meResyBarrelLayerModule_%d_%d", i + 1, j + 1);
0272       meResyBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0273       sprintf(chisto, "mePullxBarrelLayerModule_%d_%d", i + 1, j + 1);
0274       mePullxBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0275       sprintf(chisto, "mePullyBarrelLayerModule_%d_%d", i + 1, j + 1);
0276       mePullyBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0277       sprintf(chisto, "meNpixBarrelLayerModule_%d_%d", i + 1, j + 1);
0278       meNpixBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0279       sprintf(chisto, "meNxpixBarrelLayerModule_%d_%d", i + 1, j + 1);
0280       meNxpixBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0281       sprintf(chisto, "meNypixBarrelLayerModule_%d_%d", i + 1, j + 1);
0282       meNypixBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0283       sprintf(chisto, "meChargeBarrelLayerModule_%d_%d", i + 1, j + 1);
0284       meChargeBarrelLayerModule[i][j] = ibooker.book1D(chisto, chisto, 100, barrel_chargel, barrel_chargeh);
0285 
0286       sprintf(chisto, "meResXvsAlphaBarrelLayerModule_%d_%d", i + 1, j + 1);
0287       meResXvsAlphaBarrelLayerModule[i][j] =
0288           ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
0289       sprintf(chisto, "meResYvsAlphaBarrelLayerModule_%d_%d", i + 1, j + 1);
0290       meResYvsAlphaBarrelLayerModule[i][j] =
0291           ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
0292       sprintf(chisto, "meResXvsBetaBarrelLayerModule_%d_%d", i + 1, j + 1);
0293       meResXvsBetaBarrelLayerModule[i][j] =
0294           ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
0295       sprintf(chisto, "meResYvsBetaBarrelLayerModule_%d_%d", i + 1, j + 1);
0296       meResYvsBetaBarrelLayerModule[i][j] =
0297           ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");
0298 
0299       sprintf(chisto, "mePullXvsAlphaBarrelLayerModule_%d_%d", i + 1, j + 1);
0300       mePullXvsAlphaBarrelLayerModule[i][j] =
0301           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
0302       sprintf(chisto, "mePullYvsAlphaBarrelLayerModule_%d_%d", i + 1, j + 1);
0303       mePullYvsAlphaBarrelLayerModule[i][j] =
0304           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");
0305       sprintf(chisto, "mePullXvsBetaBarrelLayerModule_%d_%d", i + 1, j + 1);
0306       mePullXvsBetaBarrelLayerModule[i][j] =
0307           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
0308       sprintf(chisto, "mePullYvsBetaBarrelLayerModule_%d_%d", i + 1, j + 1);
0309       mePullYvsBetaBarrelLayerModule[i][j] =
0310           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");
0311       sprintf(chisto, "mePullXvsPhiBarrelLayerModule_%d_%d", i + 1, j + 1);
0312       mePullXvsPhiBarrelLayerModule[i][j] =
0313           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
0314       sprintf(chisto, "mePullYvsPhiBarrelLayerModule_%d_%d", i + 1, j + 1);
0315       mePullYvsPhiBarrelLayerModule[i][j] =
0316           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");
0317       sprintf(chisto, "mePullXvsEtaBarrelLayerModule_%d_%d", i + 1, j + 1);
0318       mePullXvsEtaBarrelLayerModule[i][j] =
0319           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
0320       sprintf(chisto, "mePullYvsEtaBarrelLayerModule_%d_%d", i + 1, j + 1);
0321       mePullYvsEtaBarrelLayerModule[i][j] =
0322           ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");
0323     }  //  for (int j=0; j<8; j++) // loop over rings
0324 
0325   }  // for (int i=0; i<3 ; i++) // loop over layers
0326 
0327   // Pixel forward detector has 2 disks, 2 panels and either 3 or 4 plaquettes
0328   // Panel 1 has 4 plaquettes
0329   // Panel 2 has 3 plaquettes
0330 
0331   // Panel 1: 2 disks, 4 plaquets
0332   // Panel 2: 2 disks, 3 plaquets
0333   for (int i = 0; i < 2; i++)    // loop over disks
0334     for (int j = 0; j < 4; j++)  // loop over plaquettes
0335     {
0336       Char_t chisto[100];
0337 
0338       sprintf(chisto, "mePosxZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0339       mePosxZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, xl, xh);
0340       sprintf(chisto, "mePosyZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0341       mePosyZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, yl, yh);
0342       sprintf(chisto, "meErrxZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0343       meErrxZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0344       sprintf(chisto, "meErryZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0345       meErryZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0346       sprintf(chisto, "meResxZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0347       meResxZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0348       sprintf(chisto, "meResyZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0349       meResyZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0350       sprintf(chisto, "mePullxZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0351       mePullxZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0352       sprintf(chisto, "mePullyZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0353       mePullyZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0354       sprintf(chisto, "meNpixZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0355       meNpixZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0356       sprintf(chisto, "meNxpixZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0357       meNxpixZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0358       sprintf(chisto, "meNypixZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0359       meNypixZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0360       sprintf(chisto, "meChargeZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0361       meChargeZmPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0362 
0363       sprintf(chisto, "meResXvsAlphaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0364       meResXvsAlphaZmPanel1DiskPlaq[i][j] =
0365           ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resxh, "");
0366       sprintf(chisto, "meResYvsAlphaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0367       meResYvsAlphaZmPanel1DiskPlaq[i][j] =
0368           ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resyh, "");
0369       sprintf(chisto, "meResXvsBetaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0370       meResXvsBetaZmPanel1DiskPlaq[i][j] =
0371           ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resxh, "");
0372       sprintf(chisto, "meResYvsBetaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0373       meResYvsBetaZmPanel1DiskPlaq[i][j] =
0374           ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resyh, "");
0375 
0376       sprintf(chisto, "mePullXvsAlphaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0377       mePullXvsAlphaZmPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0378           chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl, pullxh, "");
0379       sprintf(chisto, "mePullYvsAlphaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0380       mePullYvsAlphaZmPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0381           chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl, pullyh, "");
0382       sprintf(chisto, "mePullXvsBetaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0383       mePullXvsBetaZmPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0384           chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl, pullxh, "");
0385       sprintf(chisto, "mePullYvsBetaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0386       mePullYvsBetaZmPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0387           chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl, pullyh, "");
0388       sprintf(chisto, "mePullXvsPhiZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0389       mePullXvsPhiZmPanel1DiskPlaq[i][j] =
0390           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0391       sprintf(chisto, "mePullYvsPhiZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0392       mePullYvsPhiZmPanel1DiskPlaq[i][j] =
0393           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0394       sprintf(chisto, "mePullXvsEtaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0395       mePullXvsEtaZmPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0396           chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl, pullxh, "");
0397       sprintf(chisto, "mePullYvsEtaZmPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0398       mePullYvsEtaZmPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0399           chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl, pullyh, "");
0400 
0401       sprintf(chisto, "mePosxZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0402       mePosxZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, xl, xh);
0403       sprintf(chisto, "mePosyZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0404       mePosyZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, yl, yh);
0405       sprintf(chisto, "meErrxZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0406       meErrxZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0407       sprintf(chisto, "meErryZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0408       meErryZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0409       sprintf(chisto, "meResxZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0410       meResxZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0411       sprintf(chisto, "meResyZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0412       meResyZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0413       sprintf(chisto, "mePullxZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0414       mePullxZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0415       sprintf(chisto, "mePullyZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0416       mePullyZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0417       sprintf(chisto, "meNpixZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0418       meNpixZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0419       sprintf(chisto, "meNxpixZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0420       meNxpixZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0421       sprintf(chisto, "meNypixZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0422       meNypixZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0423       sprintf(chisto, "meChargeZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0424       meChargeZpPanel1DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0425       sprintf(chisto, "meResXvsAlphaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0426       meResXvsAlphaZpPanel1DiskPlaq[i][j] =
0427           ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resxh, "");
0428       sprintf(chisto, "meResYvsAlphaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0429       meResYvsAlphaZpPanel1DiskPlaq[i][j] =
0430           ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resyh, "");
0431       sprintf(chisto, "meResXvsBetaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0432       meResXvsBetaZpPanel1DiskPlaq[i][j] =
0433           ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resxh, "");
0434       sprintf(chisto, "meResYvsBetaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0435       meResYvsBetaZpPanel1DiskPlaq[i][j] =
0436           ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resyh, "");
0437 
0438       sprintf(chisto, "mePullXvsAlphaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0439       mePullXvsAlphaZpPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0440           chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl, pullxh, "");
0441       sprintf(chisto, "mePullYvsAlphaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0442       mePullYvsAlphaZpPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0443           chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl, pullyh, "");
0444       sprintf(chisto, "mePullXvsBetaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0445       mePullXvsBetaZpPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0446           chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl, pullxh, "");
0447       sprintf(chisto, "mePullYvsBetaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0448       mePullYvsBetaZpPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0449           chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl, pullyh, "");
0450       sprintf(chisto, "mePullXvsPhiZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0451       mePullXvsPhiZpPanel1DiskPlaq[i][j] =
0452           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0453       sprintf(chisto, "mePullYvsPhiZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0454       mePullYvsPhiZpPanel1DiskPlaq[i][j] =
0455           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0456       sprintf(chisto, "mePullXvsEtaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0457       mePullXvsEtaZpPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0458           chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl, pullxh, "");
0459       sprintf(chisto, "mePullYvsEtaZpPanel1DiskPlaq_%d_%d", i + 1, j + 1);
0460       mePullYvsEtaZpPanel1DiskPlaq[i][j] = ibooker.bookProfile(
0461           chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl, pullyh, "");
0462 
0463       if (j > 2)
0464         continue;  // panel 2 has only 3 plaquettes
0465 
0466       sprintf(chisto, "mePosxZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0467       mePosxZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, xl, xh);
0468       sprintf(chisto, "mePosyZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0469       mePosyZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, yl, yh);
0470       sprintf(chisto, "meErrxZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0471       meErrxZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0472       sprintf(chisto, "meErryZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0473       meErryZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0474       sprintf(chisto, "meResxZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0475       meResxZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0476       sprintf(chisto, "meResyZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0477       meResyZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0478       sprintf(chisto, "mePullxZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0479       mePullxZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0480       sprintf(chisto, "mePullyZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0481       mePullyZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0482       sprintf(chisto, "meNpixZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0483       meNpixZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0484       sprintf(chisto, "meNxpixZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0485       meNxpixZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0486       sprintf(chisto, "meNypixZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0487       meNypixZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0488       sprintf(chisto, "meChargeZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0489       meChargeZmPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0490       sprintf(chisto, "meResXvsAlphaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0491       meResXvsAlphaZmPanel2DiskPlaq[i][j] =
0492           ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resxh, "");
0493       sprintf(chisto, "meResYvsAlphaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0494       meResYvsAlphaZmPanel2DiskPlaq[i][j] =
0495           ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resyh, "");
0496       sprintf(chisto, "meResXvsBetaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0497       meResXvsBetaZmPanel2DiskPlaq[i][j] =
0498           ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resxh, "");
0499       sprintf(chisto, "meResYvsBetaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0500       meResYvsBetaZmPanel2DiskPlaq[i][j] =
0501           ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resyh, "");
0502 
0503       sprintf(chisto, "mePullXvsAlphaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0504       mePullXvsAlphaZmPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0505           chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl, pullxh, "");
0506       sprintf(chisto, "mePullYvsAlphaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0507       mePullYvsAlphaZmPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0508           chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl, pullyh, "");
0509       sprintf(chisto, "mePullXvsBetaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0510       mePullXvsBetaZmPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0511           chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl, pullxh, "");
0512       sprintf(chisto, "mePullYvsBetaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0513       mePullYvsBetaZmPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0514           chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl, pullyh, "");
0515       sprintf(chisto, "mePullXvsPhiZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0516       mePullXvsPhiZmPanel2DiskPlaq[i][j] =
0517           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0518       sprintf(chisto, "mePullYvsPhiZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0519       mePullYvsPhiZmPanel2DiskPlaq[i][j] =
0520           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0521       sprintf(chisto, "mePullXvsEtaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0522       mePullXvsEtaZmPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0523           chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl, pullxh, "");
0524       sprintf(chisto, "mePullYvsEtaZmPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0525       mePullYvsEtaZmPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0526           chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl, pullyh, "");
0527 
0528       sprintf(chisto, "mePosxZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0529       mePosxZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, xl, xh);
0530       sprintf(chisto, "mePosyZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0531       mePosyZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, yl, yh);
0532       sprintf(chisto, "meErrxZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0533       meErrxZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0534       sprintf(chisto, "meErryZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0535       meErryZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0536       sprintf(chisto, "meResxZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0537       meResxZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0538       sprintf(chisto, "meResyZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0539       meResyZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0540       sprintf(chisto, "mePullxZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0541       mePullxZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0542       sprintf(chisto, "mePullyZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0543       mePullyZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0544       sprintf(chisto, "meNpixZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0545       meNpixZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0546       sprintf(chisto, "meNxpixZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0547       meNxpixZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0548       sprintf(chisto, "meNypixZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0549       meNypixZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0550       sprintf(chisto, "meChargeZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0551       meChargeZpPanel2DiskPlaq[i][j] = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0552       sprintf(chisto, "meResXvsAlphaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0553       meResXvsAlphaZpPanel2DiskPlaq[i][j] =
0554           ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resxh, "");
0555       sprintf(chisto, "meResYvsAlphaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0556       meResYvsAlphaZpPanel2DiskPlaq[i][j] =
0557           ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resyh, "");
0558       sprintf(chisto, "meResXvsBetaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0559       meResXvsBetaZpPanel2DiskPlaq[i][j] =
0560           ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resxh, "");
0561       sprintf(chisto, "meResYvsBetaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0562       meResYvsBetaZpPanel2DiskPlaq[i][j] =
0563           ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resyh, "");
0564 
0565       sprintf(chisto, "mePullXvsAlphaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0566       mePullXvsAlphaZpPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0567           chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl, pullxh, "");
0568       sprintf(chisto, "mePullYvsAlphaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0569       mePullYvsAlphaZpPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0570           chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl, pullyh, "");
0571       sprintf(chisto, "mePullXvsBetaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0572       mePullXvsBetaZpPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0573           chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl, pullxh, "");
0574       sprintf(chisto, "mePullYvsBetaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0575       mePullYvsBetaZpPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0576           chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl, pullyh, "");
0577       sprintf(chisto, "mePullXvsPhiZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0578       mePullXvsPhiZpPanel2DiskPlaq[i][j] =
0579           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0580       sprintf(chisto, "mePullYvsPhiZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0581       mePullYvsPhiZpPanel2DiskPlaq[i][j] =
0582           ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0583       sprintf(chisto, "mePullXvsEtaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0584       mePullXvsEtaZpPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0585           chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl, pullxh, "");
0586       sprintf(chisto, "mePullYvsEtaZpPanel2DiskPlaq_%d_%d", i + 1, j + 1);
0587       mePullYvsEtaZpPanel2DiskPlaq[i][j] = ibooker.bookProfile(
0588           chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl, pullyh, "");
0589 
0590     }  // for (int j=0; j<4; j++) // loop over plaquettes
0591 
0592   ibooker.setCurrentFolder("Tracking/TrackingRecHits/Pixel/Histograms_all");
0593 
0594   Char_t chisto[100];
0595   sprintf(chisto, "mePosxBarrel");
0596   mePosxBarrel = ibooker.book1D(chisto, chisto, 100, xl, xh);
0597   sprintf(chisto, "mePosyBarrel");
0598   mePosyBarrel = ibooker.book1D(chisto, chisto, 100, yl, yh);
0599   sprintf(chisto, "meErrxBarrel");
0600   meErrxBarrel = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0601   sprintf(chisto, "meErryBarrel");
0602   meErryBarrel = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0603   sprintf(chisto, "meResxBarrel");
0604   meResxBarrel = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0605   sprintf(chisto, "meResyBarrel");
0606   meResyBarrel = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0607   sprintf(chisto, "mePullxBarrel");
0608   mePullxBarrel = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0609   sprintf(chisto, "mePullyBarrel");
0610   mePullyBarrel = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0611   sprintf(chisto, "meNpixBarrel");
0612   meNpixBarrel = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0613   sprintf(chisto, "meNxpixBarrel");
0614   meNxpixBarrel = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0615   sprintf(chisto, "meNypixBarrel");
0616   meNypixBarrel = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0617   sprintf(chisto, "meChargeBarrel");
0618   meChargeBarrel = ibooker.book1D(chisto, chisto, 100, barrel_chargel, barrel_chargeh);
0619   sprintf(chisto, "meResXvsAlphaBarrel");
0620   meResXvsAlphaBarrel = ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
0621   sprintf(chisto, "meResYvsAlphaBarrel");
0622   meResYvsAlphaBarrel = ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
0623   sprintf(chisto, "meResXvsBetaBarrel");
0624   meResXvsBetaBarrel = ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
0625   sprintf(chisto, "meResYvsBetaBarrel");
0626   meResYvsBetaBarrel = ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");
0627 
0628   sprintf(chisto, "mePullXvsAlphaBarrel");
0629   mePullXvsAlphaBarrel =
0630       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
0631   sprintf(chisto, "mePullYvsAlphaBarrel");
0632   mePullYvsAlphaBarrel =
0633       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");
0634   sprintf(chisto, "mePullXvsBetaBarrel");
0635   mePullXvsBetaBarrel =
0636       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
0637   sprintf(chisto, "mePullYvsBetaBarrel");
0638   mePullYvsBetaBarrel =
0639       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");
0640   sprintf(chisto, "mePullXvsPhiBarrel");
0641   mePullXvsPhiBarrel =
0642       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
0643   sprintf(chisto, "mePullYvsPhiBarrel");
0644   mePullYvsPhiBarrel =
0645       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");
0646   sprintf(chisto, "mePullXvsEtaBarrel");
0647   mePullXvsEtaBarrel =
0648       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
0649   sprintf(chisto, "mePullYvsEtaBarrel");
0650   mePullYvsEtaBarrel =
0651       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");
0652 
0653   sprintf(chisto, "mePosxBarrelHalfModule");
0654   mePosxBarrelHalfModule = ibooker.book1D(chisto, chisto, 100, xl, xh);
0655   sprintf(chisto, "mePosxBarrelFullModule");
0656   mePosxBarrelFullModule = ibooker.book1D(chisto, chisto, 100, xl, xh);
0657   sprintf(chisto, "mePosxBarrelFlippedLadders");
0658   mePosxBarrelFlippedLadders = ibooker.book1D(chisto, chisto, 100, xl, xh);
0659   sprintf(chisto, "mePosxBarrelNonFlippedLadders");
0660   mePosxBarrelNonFlippedLadders = ibooker.book1D(chisto, chisto, 100, xl, xh);
0661   sprintf(chisto, "mePosyBarrelHalfModule");
0662   mePosyBarrelHalfModule = ibooker.book1D(chisto, chisto, 100, yl, yh);
0663   sprintf(chisto, "mePosyBarrelFullModule");
0664   mePosyBarrelFullModule = ibooker.book1D(chisto, chisto, 100, yl, yh);
0665   sprintf(chisto, "mePosyBarrelFlippedLadders");
0666   mePosyBarrelFlippedLadders = ibooker.book1D(chisto, chisto, 100, yl, yh);
0667   sprintf(chisto, "mePosyBarrelNonFlippedLadders");
0668   mePosyBarrelNonFlippedLadders = ibooker.book1D(chisto, chisto, 100, yl, yh);
0669 
0670   sprintf(chisto, "meResXvsAlphaBarrelFlippedLadders");
0671   meResXvsAlphaBarrelFlippedLadders =
0672       ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
0673   sprintf(chisto, "meResYvsAlphaBarrelFlippedLadders");
0674   meResYvsAlphaBarrelFlippedLadders =
0675       ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
0676   sprintf(chisto, "meResXvsBetaBarrelFlippedLadders");
0677   meResXvsBetaBarrelFlippedLadders =
0678       ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
0679   sprintf(chisto, "meResYvsBetaBarrelFlippedLadders");
0680   meResYvsBetaBarrelFlippedLadders =
0681       ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");
0682 
0683   sprintf(chisto, "mePullXvsAlphaBarrelFlippedLadders");
0684   mePullXvsAlphaBarrelFlippedLadders =
0685       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
0686   sprintf(chisto, "mePullYvsAlphaBarrelFlippedLadders");
0687   mePullYvsAlphaBarrelFlippedLadders =
0688       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");
0689   sprintf(chisto, "mePullXvsBetaBarrelFlippedLadders");
0690   mePullXvsBetaBarrelFlippedLadders =
0691       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
0692   sprintf(chisto, "mePullYvsBetaBarrelFlippedLadders");
0693   mePullYvsBetaBarrelFlippedLadders =
0694       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");
0695   sprintf(chisto, "mePullXvsPhiBarrelFlippedLadders");
0696   mePullXvsPhiBarrelFlippedLadders =
0697       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
0698   sprintf(chisto, "mePullYvsPhiBarrelFlippedLadders");
0699   mePullYvsPhiBarrelFlippedLadders =
0700       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");
0701   sprintf(chisto, "mePullXvsEtaBarrelFlippedLadders");
0702   mePullXvsEtaBarrelFlippedLadders =
0703       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
0704   sprintf(chisto, "mePullYvsEtaBarrelFlippedLadders");
0705   mePullYvsEtaBarrelFlippedLadders =
0706       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");
0707 
0708   sprintf(chisto, "meWPullXvsAlphaBarrelFlippedLadders");
0709   meWPullXvsAlphaBarrelFlippedLadders =
0710       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
0711   sprintf(chisto, "meWPullYvsAlphaBarrelFlippedLadders");
0712   meWPullYvsAlphaBarrelFlippedLadders =
0713       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");
0714   sprintf(chisto, "meWPullXvsBetaBarrelFlippedLadders");
0715   meWPullXvsBetaBarrelFlippedLadders =
0716       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
0717   sprintf(chisto, "meWPullYvsBetaBarrelFlippedLadders");
0718   meWPullYvsBetaBarrelFlippedLadders =
0719       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");
0720 
0721   sprintf(chisto, "meResXvsAlphaBarrelNonFlippedLadders");
0722   meResXvsAlphaBarrelNonFlippedLadders =
0723       ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
0724   sprintf(chisto, "meResYvsAlphaBarrelNonFlippedLadders");
0725   meResYvsAlphaBarrelNonFlippedLadders =
0726       ibooker.bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
0727   sprintf(chisto, "meResXvsBetaBarrelNonFlippedLadders");
0728   meResXvsBetaBarrelNonFlippedLadders =
0729       ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
0730   sprintf(chisto, "meResYvsBetaBarrelNonFlippedLadders");
0731   meResYvsBetaBarrelNonFlippedLadders =
0732       ibooker.bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");
0733 
0734   sprintf(chisto, "mePullXvsAlphaBarrelNonFlippedLadders");
0735   mePullXvsAlphaBarrelNonFlippedLadders =
0736       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
0737   sprintf(chisto, "mePullYvsAlphaBarrelNonFlippedLadders");
0738   mePullYvsAlphaBarrelNonFlippedLadders =
0739       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");
0740   sprintf(chisto, "mePullXvsBetaBarrelNonFlippedLadders");
0741   mePullXvsBetaBarrelNonFlippedLadders =
0742       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
0743   sprintf(chisto, "mePullYvsBetaBarrelNonFlippedLadders");
0744   mePullYvsBetaBarrelNonFlippedLadders =
0745       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");
0746   sprintf(chisto, "mePullXvsPhiBarrelNonFlippedLadders");
0747   mePullXvsPhiBarrelNonFlippedLadders =
0748       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
0749   sprintf(chisto, "mePullYvsPhiBarrelNonFlippedLadders");
0750   mePullYvsPhiBarrelNonFlippedLadders =
0751       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");
0752   sprintf(chisto, "mePullXvsEtaBarrelNonFlippedLadders");
0753   mePullXvsEtaBarrelNonFlippedLadders =
0754       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
0755   sprintf(chisto, "mePullYvsEtaBarrelNonFlippedLadders");
0756   mePullYvsEtaBarrelNonFlippedLadders =
0757       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");
0758 
0759   sprintf(chisto, "meWPullXvsAlphaBarrelNonFlippedLadders");
0760   meWPullXvsAlphaBarrelNonFlippedLadders =
0761       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
0762   sprintf(chisto, "meWPullYvsAlphaBarrelNonFlippedLadders");
0763   meWPullYvsAlphaBarrelNonFlippedLadders =
0764       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");
0765   sprintf(chisto, "meWPullXvsBetaBarrelNonFlippedLadders");
0766   meWPullXvsBetaBarrelNonFlippedLadders =
0767       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
0768   sprintf(chisto, "meWPullYvsBetaBarrelNonFlippedLadders");
0769   meWPullYvsBetaBarrelNonFlippedLadders =
0770       ibooker.bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");
0771 
0772   sprintf(chisto, "mePosxZmPanel1");
0773   mePosxZmPanel1 = ibooker.book1D(chisto, chisto, 100, xl, xh);
0774   sprintf(chisto, "mePosyZmPanel1");
0775   mePosyZmPanel1 = ibooker.book1D(chisto, chisto, 100, yl, yh);
0776   sprintf(chisto, "meErrxZmPanel1");
0777   meErrxZmPanel1 = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0778   sprintf(chisto, "meErryZmPanel1");
0779   meErryZmPanel1 = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0780   sprintf(chisto, "meResxZmPanel1");
0781   meResxZmPanel1 = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0782   sprintf(chisto, "meResyZmPanel1");
0783   meResyZmPanel1 = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0784   sprintf(chisto, "mePullxZmPanel1");
0785   mePullxZmPanel1 = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0786   sprintf(chisto, "mePullyZmPanel1");
0787   mePullyZmPanel1 = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0788   sprintf(chisto, "meNpixZmPanel1");
0789   meNpixZmPanel1 = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0790   sprintf(chisto, "meNxpixZmPanel1");
0791   meNxpixZmPanel1 = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0792   sprintf(chisto, "meNypixZmPanel1");
0793   meNypixZmPanel1 = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0794   sprintf(chisto, "meChargeZmPanel1");
0795   meChargeZmPanel1 = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0796   sprintf(chisto, "meResXvsAlphaZmPanel1");
0797   meResXvsAlphaZmPanel1 =
0798       ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resxh, "");
0799   sprintf(chisto, "meResYvsAlphaZmPanel1");
0800   meResYvsAlphaZmPanel1 =
0801       ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resyh, "");
0802   sprintf(chisto, "meResXvsBetaZmPanel1");
0803   meResXvsBetaZmPanel1 =
0804       ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resxh, "");
0805   sprintf(chisto, "meResYvsBetaZmPanel1");
0806   meResYvsBetaZmPanel1 =
0807       ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resyh, "");
0808 
0809   sprintf(chisto, "mePullXvsAlphaZmPanel1");
0810   mePullXvsAlphaZmPanel1 =
0811       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl, pullxh, "");
0812   sprintf(chisto, "mePullYvsAlphaZmPanel1");
0813   mePullYvsAlphaZmPanel1 =
0814       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl, pullyh, "");
0815   sprintf(chisto, "mePullXvsBetaZmPanel1");
0816   mePullXvsBetaZmPanel1 =
0817       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl, pullxh, "");
0818   sprintf(chisto, "mePullYvsBetaZmPanel1");
0819   mePullYvsBetaZmPanel1 =
0820       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl, pullyh, "");
0821   sprintf(chisto, "mePullXvsPhiZmPanel1");
0822   mePullXvsPhiZmPanel1 =
0823       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0824   sprintf(chisto, "mePullYvsPhiZmPanel1");
0825   mePullYvsPhiZmPanel1 =
0826       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0827   sprintf(chisto, "mePullXvsEtaZmPanel1");
0828   mePullXvsEtaZmPanel1 =
0829       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl, pullxh, "");
0830   sprintf(chisto, "mePullYvsEtaZmPanel1");
0831   mePullYvsEtaZmPanel1 =
0832       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl, pullyh, "");
0833 
0834   sprintf(chisto, "meWPullXvsAlphaZmPanel1");
0835   meWPullXvsAlphaZmPanel1 =
0836       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl, pullxh, "");
0837   sprintf(chisto, "meWPullYvsAlphaZmPanel1");
0838   meWPullYvsAlphaZmPanel1 =
0839       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl, pullyh, "");
0840   sprintf(chisto, "meWPullXvsBetaZmPanel1");
0841   meWPullXvsBetaZmPanel1 =
0842       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl, pullxh, "");
0843   sprintf(chisto, "meWPullYvsBetaZmPanel1");
0844   meWPullYvsBetaZmPanel1 =
0845       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl, pullyh, "");
0846 
0847   sprintf(chisto, "mePosxZpPanel1");
0848   mePosxZpPanel1 = ibooker.book1D(chisto, chisto, 100, xl, xh);
0849   sprintf(chisto, "mePosyZpPanel1");
0850   mePosyZpPanel1 = ibooker.book1D(chisto, chisto, 100, yl, yh);
0851   sprintf(chisto, "meErrxZpPanel1");
0852   meErrxZpPanel1 = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0853   sprintf(chisto, "meErryZpPanel1");
0854   meErryZpPanel1 = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0855   sprintf(chisto, "meResxZpPanel1");
0856   meResxZpPanel1 = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0857   sprintf(chisto, "meResyZpPanel1");
0858   meResyZpPanel1 = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0859   sprintf(chisto, "mePullxZpPanel1");
0860   mePullxZpPanel1 = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0861   sprintf(chisto, "mePullyZpPanel1");
0862   mePullyZpPanel1 = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0863   sprintf(chisto, "meNpixZpPanel1");
0864   meNpixZpPanel1 = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0865   sprintf(chisto, "meNxpixZpPanel1");
0866   meNxpixZpPanel1 = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0867   sprintf(chisto, "meNypixZpPanel1");
0868   meNypixZpPanel1 = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0869   sprintf(chisto, "meChargeZpPanel1");
0870   meChargeZpPanel1 = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0871   sprintf(chisto, "meResXvsAlphaZpPanel1");
0872   meResXvsAlphaZpPanel1 =
0873       ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resxh, "");
0874   sprintf(chisto, "meResYvsAlphaZpPanel1");
0875   meResYvsAlphaZpPanel1 =
0876       ibooker.bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0, resyh, "");
0877   sprintf(chisto, "meResXvsBetaZpPanel1");
0878   meResXvsBetaZpPanel1 =
0879       ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resxh, "");
0880   sprintf(chisto, "meResYvsBetaZpPanel1");
0881   meResYvsBetaZpPanel1 =
0882       ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resyh, "");
0883 
0884   sprintf(chisto, "mePullXvsAlphaZpPanel1");
0885   mePullXvsAlphaZpPanel1 =
0886       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl, pullxh, "");
0887   sprintf(chisto, "mePullYvsAlphaZpPanel1");
0888   mePullYvsAlphaZpPanel1 =
0889       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl, pullyh, "");
0890   sprintf(chisto, "mePullXvsBetaZpPanel1");
0891   mePullXvsBetaZpPanel1 =
0892       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl, pullxh, "");
0893   sprintf(chisto, "mePullYvsBetaZpPanel1");
0894   mePullYvsBetaZpPanel1 =
0895       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl, pullyh, "");
0896   sprintf(chisto, "mePullXvsPhiZpPanel1");
0897   mePullXvsPhiZpPanel1 =
0898       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0899   sprintf(chisto, "mePullYvsPhiZpPanel1");
0900   mePullYvsPhiZpPanel1 =
0901       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0902   sprintf(chisto, "mePullXvsEtaZpPanel1");
0903   mePullXvsEtaZpPanel1 =
0904       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl, pullxh, "");
0905   sprintf(chisto, "mePullYvsEtaZpPanel1");
0906   mePullYvsEtaZpPanel1 =
0907       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl, pullyh, "");
0908 
0909   sprintf(chisto, "meWPullXvsAlphaZpPanel1");
0910   meWPullXvsAlphaZpPanel1 =
0911       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl, pullxh, "");
0912   sprintf(chisto, "meWPullYvsAlphaZpPanel1");
0913   meWPullYvsAlphaZpPanel1 =
0914       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl, pullyh, "");
0915   sprintf(chisto, "meWPullXvsBetaZpPanel1");
0916   meWPullXvsBetaZpPanel1 =
0917       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl, pullxh, "");
0918   sprintf(chisto, "meWPullYvsBetaZpPanel1");
0919   meWPullYvsBetaZpPanel1 =
0920       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl, pullyh, "");
0921 
0922   sprintf(chisto, "mePosxZmPanel2");
0923   mePosxZmPanel2 = ibooker.book1D(chisto, chisto, 100, xl, xh);
0924   sprintf(chisto, "mePosyZmPanel2");
0925   mePosyZmPanel2 = ibooker.book1D(chisto, chisto, 100, yl, yh);
0926   sprintf(chisto, "meErrxZmPanel2");
0927   meErrxZmPanel2 = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
0928   sprintf(chisto, "meErryZmPanel2");
0929   meErryZmPanel2 = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
0930   sprintf(chisto, "meResxZmPanel2");
0931   meResxZmPanel2 = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
0932   sprintf(chisto, "meResyZmPanel2");
0933   meResyZmPanel2 = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
0934   sprintf(chisto, "mePullxZmPanel2");
0935   mePullxZmPanel2 = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
0936   sprintf(chisto, "mePullyZmPanel2");
0937   mePullyZmPanel2 = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
0938   sprintf(chisto, "meNpixZmPanel2");
0939   meNpixZmPanel2 = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
0940   sprintf(chisto, "meNxpixZmPanel2");
0941   meNxpixZmPanel2 = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
0942   sprintf(chisto, "meNypixZmPanel2");
0943   meNypixZmPanel2 = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
0944   sprintf(chisto, "meChargeZmPanel2");
0945   meChargeZmPanel2 = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
0946   sprintf(chisto, "meResXvsAlphaZmPanel2");
0947   meResXvsAlphaZmPanel2 =
0948       ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resxh, "");
0949   sprintf(chisto, "meResYvsAlphaZmPanel2");
0950   meResYvsAlphaZmPanel2 =
0951       ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resyh, "");
0952   sprintf(chisto, "meResXvsBetaZmPanel2");
0953   meResXvsBetaZmPanel2 =
0954       ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resxh, "");
0955   sprintf(chisto, "meResYvsBetaZmPanel2");
0956   meResYvsBetaZmPanel2 =
0957       ibooker.bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0, resyh, "");
0958 
0959   sprintf(chisto, "mePullXvsAlphaZmPanel2");
0960   mePullXvsAlphaZmPanel2 =
0961       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl, pullxh, "");
0962   sprintf(chisto, "mePullYvsAlphaZmPanel2");
0963   mePullYvsAlphaZmPanel2 =
0964       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl, pullyh, "");
0965   sprintf(chisto, "mePullXvsBetaZmPanel2");
0966   mePullXvsBetaZmPanel2 =
0967       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl, pullxh, "");
0968   sprintf(chisto, "mePullYvsBetaZmPanel2");
0969   mePullYvsBetaZmPanel2 =
0970       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl, pullyh, "");
0971   sprintf(chisto, "mePullXvsPhiZmPanel2");
0972   mePullXvsPhiZmPanel2 =
0973       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
0974   sprintf(chisto, "mePullYvsPhiZmPanel2");
0975   mePullYvsPhiZmPanel2 =
0976       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
0977   sprintf(chisto, "mePullXvsEtaZmPanel2");
0978   mePullXvsEtaZmPanel2 =
0979       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl, pullxh, "");
0980   sprintf(chisto, "mePullYvsEtaZmPanel2");
0981   mePullYvsEtaZmPanel2 =
0982       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl, pullyh, "");
0983 
0984   sprintf(chisto, "meWPullXvsAlphaZmPanel2");
0985   meWPullXvsAlphaZmPanel2 =
0986       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl, pullxh, "");
0987   sprintf(chisto, "meWPullYvsAlphaZmPanel2");
0988   meWPullYvsAlphaZmPanel2 =
0989       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl, pullyh, "");
0990   sprintf(chisto, "meWPullXvsBetaZmPanel2");
0991   meWPullXvsBetaZmPanel2 =
0992       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl, pullxh, "");
0993   sprintf(chisto, "meWPullYvsBetaZmPanel2");
0994   meWPullYvsBetaZmPanel2 =
0995       ibooker.bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl, pullyh, "");
0996 
0997   sprintf(chisto, "mePosxZpPanel2");
0998   mePosxZpPanel2 = ibooker.book1D(chisto, chisto, 100, xl, xh);
0999   sprintf(chisto, "mePosyZpPanel2");
1000   mePosyZpPanel2 = ibooker.book1D(chisto, chisto, 100, yl, yh);
1001   sprintf(chisto, "meErrxZpPanel2");
1002   meErrxZpPanel2 = ibooker.book1D(chisto, chisto, 100, errxl, errxh);
1003   sprintf(chisto, "meErryZpPanel2");
1004   meErryZpPanel2 = ibooker.book1D(chisto, chisto, 100, erryl, erryh);
1005   sprintf(chisto, "meResxZpPanel2");
1006   meResxZpPanel2 = ibooker.book1D(chisto, chisto, 100, resxl, resxh);
1007   sprintf(chisto, "meResyZpPanel2");
1008   meResyZpPanel2 = ibooker.book1D(chisto, chisto, 100, resyl, resyh);
1009   sprintf(chisto, "mePullxZpPanel2");
1010   mePullxZpPanel2 = ibooker.book1D(chisto, chisto, 100, pullxl, pullxh);
1011   sprintf(chisto, "mePullyZpPanel2");
1012   mePullyZpPanel2 = ibooker.book1D(chisto, chisto, 100, pullyl, pullyh);
1013   sprintf(chisto, "meNpixZpPanel2");
1014   meNpixZpPanel2 = ibooker.book1D(chisto, chisto, 100, npixl, npixh);
1015   sprintf(chisto, "meNxpixZpPanel2");
1016   meNxpixZpPanel2 = ibooker.book1D(chisto, chisto, 100, nxpixl, nxpixh);
1017   sprintf(chisto, "meNypixZpPanel2");
1018   meNypixZpPanel2 = ibooker.book1D(chisto, chisto, 100, nypixl, nypixh);
1019   sprintf(chisto, "meChargeZpPanel2");
1020   meChargeZpPanel2 = ibooker.book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);
1021   sprintf(chisto, "meResXvsAlphaZpPanel2");
1022   meResXvsAlphaZpPanel2 =
1023       ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resxh, "");
1024   sprintf(chisto, "meResYvsAlphaZpPanel2");
1025   meResYvsAlphaZpPanel2 =
1026       ibooker.bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0, resyh, "");
1027   sprintf(chisto, "meResXvsBetaZpPanel2");
1028   meResXvsBetaZpPanel2 =
1029       ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resxh, "");
1030   sprintf(chisto, "meResYvsBetaZpPanel2");
1031   meResYvsBetaZpPanel2 =
1032       ibooker.bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0, resyh, "");
1033 
1034   sprintf(chisto, "mePullXvsAlphaZpPanel2");
1035   mePullXvsAlphaZpPanel2 =
1036       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl, pullxh, "");
1037   sprintf(chisto, "mePullYvsAlphaZpPanel2");
1038   mePullYvsAlphaZpPanel2 =
1039       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl, pullyh, "");
1040   sprintf(chisto, "mePullXvsBetaZpPanel2");
1041   mePullXvsBetaZpPanel2 =
1042       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl, pullxh, "");
1043   sprintf(chisto, "mePullYvsBetaZpPanel2");
1044   mePullYvsBetaZpPanel2 =
1045       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl, pullyh, "");
1046   sprintf(chisto, "mePullXvsPhiZpPanel2");
1047   mePullXvsPhiZpPanel2 =
1048       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl, pullxh, "");
1049   sprintf(chisto, "mePullYvsPhiZpPanel2");
1050   mePullYvsPhiZpPanel2 =
1051       ibooker.bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl, pullyh, "");
1052   sprintf(chisto, "mePullXvsEtaZpPanel2");
1053   mePullXvsEtaZpPanel2 =
1054       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl, pullxh, "");
1055   sprintf(chisto, "mePullYvsEtaZpPanel2");
1056   mePullYvsEtaZpPanel2 =
1057       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl, pullyh, "");
1058 
1059   sprintf(chisto, "meWPullXvsAlphaZpPanel2");
1060   meWPullXvsAlphaZpPanel2 =
1061       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl, pullxh, "");
1062   sprintf(chisto, "meWPullYvsAlphaZpPanel2");
1063   meWPullYvsAlphaZpPanel2 =
1064       ibooker.bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl, pullyh, "");
1065   sprintf(chisto, "meWPullXvsBetaZpPanel2");
1066   meWPullXvsBetaZpPanel2 =
1067       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl, pullxh, "");
1068   sprintf(chisto, "meWPullYvsBetaZpPanel2");
1069   meWPullYvsBetaZpPanel2 =
1070       ibooker.bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl, pullyh, "");
1071 
1072   // all hits (not only from tracks)
1073   sprintf(chisto, "mePosxBarrel_all_hits");
1074   mePosxBarrel_all_hits = ibooker.book1D(chisto, chisto, 100, xl, xh);
1075   sprintf(chisto, "mePosyBarrel_all_hits");
1076   mePosyBarrel_all_hits = ibooker.book1D(chisto, chisto, 100, yl, yh);
1077 
1078   sprintf(chisto, "mePosxZmPanel1_all_hits");
1079   mePosxZmPanel1_all_hits = ibooker.book1D(chisto, chisto, 100, xl, xh);
1080   sprintf(chisto, "mePosyZmPanel1_all_hits");
1081   mePosyZmPanel1_all_hits = ibooker.book1D(chisto, chisto, 100, yl, yh);
1082   sprintf(chisto, "mePosxZmPanel2_all_hits");
1083   mePosxZmPanel2_all_hits = ibooker.book1D(chisto, chisto, 100, xl, xh);
1084   sprintf(chisto, "mePosyZmPanel2_all_hits");
1085   mePosyZmPanel2_all_hits = ibooker.book1D(chisto, chisto, 100, yl, yh);
1086 
1087   sprintf(chisto, "mePosxZpPanel1_all_hits");
1088   mePosxZpPanel1_all_hits = ibooker.book1D(chisto, chisto, 100, xl, xh);
1089   sprintf(chisto, "mePosyZpPanel1_all_hits");
1090   mePosyZpPanel1_all_hits = ibooker.book1D(chisto, chisto, 100, yl, yh);
1091   sprintf(chisto, "mePosxZpPanel2_all_hits");
1092   mePosxZpPanel2_all_hits = ibooker.book1D(chisto, chisto, 100, xl, xh);
1093   sprintf(chisto, "mePosyZpPanel2_all_hits");
1094   mePosyZpPanel2_all_hits = ibooker.book1D(chisto, chisto, 100, yl, yh);
1095 
1096   // control histograms
1097   meTracksPerEvent = ibooker.book1D("meTracksPerEvent", "meTracksPerEvent", 200, 0.0, 200.0);
1098   mePixRecHitsPerTrack = ibooker.book1D("mePixRecHitsPerTrack", "mePixRecHitsPerTrack", 6, 0.0, 6.0);
1099 }
1100 
1101 // Virtual destructor needed.
1102 SiPixelTrackingRecHitsValid::~SiPixelTrackingRecHitsValid() {
1103   //save local root file only in standalone mode
1104   if (runStandalone && !outputFile_.empty() && dbe_)
1105     dbe_->save(outputFile_);
1106 }
1107 
1108 // Functions that gets called by framework every event
1109 void SiPixelTrackingRecHitsValid::analyze(const edm::Event& e, const edm::EventSetup& es) {
1110   //Retrieve tracker topology from geometry
1111   const auto& tTopo = &es.getData(tTopoEsToken_);
1112 
1113   run = e.id().run();
1114   evt = e.id().event();
1115 
1116   //  if ( evt%1000 == 0 )
1117   //cout << "evt = " << evt << endl;
1118 
1119   float math_pi = 3.14159265;
1120   float radtodeg = 180.0 / math_pi;
1121 
1122   DetId detId;
1123 
1124   LocalPoint position;
1125   LocalError error;
1126   float mindist = 999999.9;
1127 
1128   std::vector<PSimHit> matched;
1129   TrackerHitAssociator associate(e, trackerHitAssociatorConfig_);
1130 
1131   const TrackerGeometry* tracker = &es.getData(tGeomEsToken_);
1132 
1133   if (!MTCCtrack_) {
1134     // --------------------------------------- all hits -----------------------------------------------------------
1135     //--- Fetch Pixel RecHits
1136     edm::Handle<SiPixelRecHitCollection> recHitColl;
1137     e.getByToken(siPixelRecHitCollectionToken_, recHitColl);
1138 
1139     //cout <<" ----- Found "
1140     //   << const_cast<SiPixelRecHitCollection*>(recHitColl.product())->size()
1141     //   << " Pixel RecHits" << std::endl;
1142 
1143     //-----Iterate over detunits
1144     for (const auto& it : tracker->dets()) {
1145       DetId detId = it->geographicalId();
1146 
1147       unsigned int subid = detId.subdetId();
1148       if (!((subid == 1) || (subid == 2)))
1149         continue;  // end subid if
1150 
1151       SiPixelRecHitCollection::const_iterator match = recHitColl->find(detId);
1152       if (match == recHitColl->end())
1153         continue;
1154 
1155       SiPixelRecHitCollection::DetSet pixelrechitRange = *match;
1156       SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
1157       SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
1158       SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
1159       std::vector<PSimHit> matched;
1160 
1161       //----Loop over rechits for this detId
1162       for (; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) {
1163         LocalPoint lp = pixeliter->localPosition();
1164         float rechitx = lp.x();
1165         float rechity = lp.y();
1166 
1167         detId = it->geographicalId();
1168         subdetId = (int)detId.subdetId();
1169         if ((int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel) {
1170           mePosxBarrel_all_hits->Fill(rechitx);
1171           mePosyBarrel_all_hits->Fill(rechity);
1172         } else if ((int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap) {
1173           side = tTopo->pxfSide(detId);
1174           disk = tTopo->pxfDisk(detId);
1175           blade = tTopo->pxfBlade(detId);
1176           panel = tTopo->pxfPanel(detId);
1177           plaq = tTopo->pxfModule(detId);  // also known as plaquette
1178 
1179           if (side == 1) {
1180             if (panel == 1) {
1181               mePosxZmPanel1_all_hits->Fill(rechitx);
1182               mePosyZmPanel1_all_hits->Fill(rechity);
1183             } else if (panel == 2) {
1184               mePosxZmPanel2_all_hits->Fill(rechitx);
1185               mePosyZmPanel2_all_hits->Fill(rechity);
1186             } else
1187               edm::LogWarning("SiPixelTrackingRecHitsValid")
1188                   << "..............................................Wrong panel number !";
1189           }  // if ( side==1 )
1190           else if (side == 2) {
1191             if (panel == 1) {
1192               mePosxZpPanel1_all_hits->Fill(rechitx);
1193               mePosyZpPanel1_all_hits->Fill(rechity);
1194             } else if (panel == 2) {
1195               mePosxZpPanel2_all_hits->Fill(rechitx);
1196               mePosyZpPanel2_all_hits->Fill(rechity);
1197             } else
1198               edm::LogWarning("SiPixelTrackingRecHitsValid")
1199                   << "..............................................Wrong panel number !";
1200           }  //else if ( side==2 )
1201           else
1202             edm::LogWarning("SiPixelTrackingRecHitsValid")
1203                 << ".......................................................Wrong side !";
1204 
1205         }  // else if ( detId.subdetId()==PixelSubdetector::PixelEndcap )
1206         else
1207           edm::LogWarning("SiPixelTrackingRecHitsValid")
1208               << "Pixel rechit collection but we are not in the pixel detector" << (int)detId.subdetId();
1209       }
1210     }
1211     // ------------------------------------------------ all hits ---------------------------------------------------------------
1212 
1213     // Get tracks
1214     edm::Handle<reco::TrackCollection> trackCollection;
1215     e.getByToken(recoTrackCollectionToken_, trackCollection);
1216     const reco::TrackCollection* tracks = trackCollection.product();
1217     reco::TrackCollection::const_iterator tciter;
1218 
1219     int n_tracks = (int)tracks->size();  // number of tracks in this event
1220     meTracksPerEvent->Fill(n_tracks);
1221 
1222     if (!tracks->empty()) {
1223       // Loop on tracks
1224       for (tciter = tracks->begin(); tciter != tracks->end(); tciter++) {
1225         phi = tciter->momentum().phi() / math_pi * 180.0;
1226         eta = tciter->momentum().eta();
1227 
1228         int n_hits = 0;
1229         // First loop on hits: find matched hits
1230         for (trackingRecHit_iterator it = tciter->recHitsBegin(); it != tciter->recHitsEnd(); it++) {
1231           const TrackingRecHit& thit = **it;
1232           // Is it a matched hit?
1233           const SiPixelRecHit* matchedhit = dynamic_cast<const SiPixelRecHit*>(&thit);
1234 
1235           if (matchedhit) {
1236             ++n_hits;
1237 
1238             layer = -9999;
1239             ladder = -9999;
1240             mod = -9999;
1241             side = -9999;
1242             disk = -9999;
1243             blade = -9999;
1244             panel = -9999;
1245             plaq = -9999;
1246 
1247             rechitx = -9999.9;
1248             rechity = -9999.9;
1249             rechitz = -9999.9;
1250             rechiterrx = -9999.9;
1251             rechiterry = -9999.9;
1252             rechitresx = -9999.9;
1253             rechitresy = -9999.9;
1254             rechitpullx = -9999.9;
1255             rechitpully = -9999.9;
1256 
1257             npix = -9999;
1258             nxpix = -9999;
1259             nypix = -9999;
1260             charge = -9999.9;
1261 
1262             alpha = -9999.9;
1263             beta = -9999.9;
1264 
1265             half = -9999;
1266             flipped = -9999;
1267 
1268             nsimhit = -9999;
1269 
1270             simhitx = -9999.9;
1271             simhity = -9999.9;
1272 
1273             position = (*it)->localPosition();
1274             error = (*it)->localPositionError();
1275 
1276             rechitx = position.x();
1277             rechity = position.y();
1278             rechitz = position.z();
1279             rechiterrx = sqrt(error.xx());
1280             rechiterry = sqrt(error.yy());
1281 
1282             npix = (*matchedhit).cluster()->size();
1283             nxpix = (*matchedhit).cluster()->sizeX();
1284             nypix = (*matchedhit).cluster()->sizeY();
1285             charge = (*matchedhit).cluster()->charge();
1286 
1287             //Association of the rechit to the simhit
1288             matched.clear();
1289             matched = associate.associateHit(*matchedhit);
1290 
1291             nsimhit = (int)matched.size();
1292 
1293             if (!matched.empty()) {
1294               mindist = 999999.9;
1295               float distx, disty, dist;
1296               bool found_hit_from_generated_particle = false;
1297 
1298               int n_assoc_muon = 0;
1299 
1300               std::vector<PSimHit>::const_iterator closestit = matched.begin();
1301               for (std::vector<PSimHit>::const_iterator m = matched.begin(); m < matched.end(); m++) {
1302                 if (checkType_) {
1303                   int pid = (*m).particleType();
1304                   if (abs(pid) != genType_)
1305                     continue;
1306                 }
1307 
1308                 float simhitx = 0.5 * ((*m).entryPoint().x() + (*m).exitPoint().x());
1309                 float simhity = 0.5 * ((*m).entryPoint().y() + (*m).exitPoint().y());
1310 
1311                 distx = fabs(rechitx - simhitx);
1312                 disty = fabs(rechity - simhity);
1313                 dist = sqrt(distx * distx + disty * disty);
1314 
1315                 if (dist < mindist) {
1316                   n_assoc_muon++;
1317 
1318                   mindist = dist;
1319                   closestit = m;
1320                   found_hit_from_generated_particle = true;
1321                 }
1322               }  // for (std::vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++)
1323 
1324               // This recHit does not have any simHit with the same particleType as the particles generated
1325               // Ignore it as most probably come from delta rays.
1326               if (checkType_ && !found_hit_from_generated_particle)
1327                 continue;
1328 
1329               if (n_assoc_muon > 1) {
1330                 edm::LogWarning("SiPixelTrackingRecHitsValid")
1331                     << " ----- This is not good: n_assoc_muon = " << n_assoc_muon;
1332                 edm::LogWarning("SiPixelTrackingRecHitsValid") << "evt = " << evt;
1333               }
1334 
1335               pidhit = (*closestit).particleType();
1336 
1337               simhitx = 0.5 * ((*closestit).entryPoint().x() + (*closestit).exitPoint().x());
1338               simhity = 0.5 * ((*closestit).entryPoint().y() + (*closestit).exitPoint().y());
1339 
1340               rechitresx = rechitx - simhitx;
1341               rechitresy = rechity - simhity;
1342               rechitpullx = (rechitx - simhitx) / sqrt(error.xx());
1343               rechitpully = (rechity - simhity) / sqrt(error.yy());
1344 
1345               float simhitpx = (*closestit).momentumAtEntry().x();
1346               float simhitpy = (*closestit).momentumAtEntry().y();
1347               float simhitpz = (*closestit).momentumAtEntry().z();
1348 
1349               //beta  = atan2(simhitpz, simhitpy) * radtodeg;
1350               //alpha = atan2(simhitpz, simhitpx) * radtodeg;
1351 
1352               beta = fabs(atan2(simhitpz, simhitpy)) * radtodeg;
1353               alpha = fabs(atan2(simhitpz, simhitpx)) * radtodeg;
1354 
1355               detId = (*it)->geographicalId();
1356 
1357               subdetId = (int)detId.subdetId();
1358 
1359               if ((int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel) {
1360                 mePosxBarrel->Fill(rechitx);
1361                 mePosyBarrel->Fill(rechity);
1362                 meErrxBarrel->Fill(rechiterrx);
1363                 meErryBarrel->Fill(rechiterry);
1364                 meResxBarrel->Fill(rechitresx);
1365                 meResyBarrel->Fill(rechitresy);
1366                 mePullxBarrel->Fill(rechitpullx);
1367                 mePullyBarrel->Fill(rechitpully);
1368                 meNpixBarrel->Fill(npix);
1369                 meNxpixBarrel->Fill(nxpix);
1370                 meNypixBarrel->Fill(nypix);
1371                 meChargeBarrel->Fill(charge);
1372                 meResXvsAlphaBarrel->Fill(alpha, fabs(rechitresx));
1373                 meResYvsAlphaBarrel->Fill(alpha, fabs(rechitresy));
1374                 meResXvsBetaBarrel->Fill(beta, fabs(rechitresx));
1375                 meResYvsBetaBarrel->Fill(beta, fabs(rechitresy));
1376                 mePullXvsAlphaBarrel->Fill(alpha, rechitpullx);
1377                 mePullYvsAlphaBarrel->Fill(alpha, rechitpully);
1378                 mePullXvsBetaBarrel->Fill(beta, rechitpullx);
1379                 mePullYvsBetaBarrel->Fill(beta, rechitpully);
1380                 mePullXvsPhiBarrel->Fill(phi, rechitpullx);
1381                 mePullYvsPhiBarrel->Fill(phi, rechitpully);
1382                 mePullXvsEtaBarrel->Fill(eta, rechitpullx);
1383                 mePullYvsEtaBarrel->Fill(eta, rechitpully);
1384 
1385                 const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(tracker->idToDet(detId));
1386                 //const PixelTopology * topol = (&(theGeomDet->specificTopology()));
1387 
1388                 int tmp_nrows = theGeomDet->specificTopology().nrows();
1389 
1390                 if (tmp_nrows == 80) {
1391                   mePosxBarrelHalfModule->Fill(rechitx);
1392                   mePosyBarrelHalfModule->Fill(rechity);
1393                   half = 1;
1394                 } else if (tmp_nrows == 160) {
1395                   mePosxBarrelFullModule->Fill(rechitx);
1396                   mePosyBarrelFullModule->Fill(rechity);
1397                   half = 0;
1398                 } else
1399                   edm::LogWarning("SiPixelTrackingRecHitsValid")
1400                       << "-------------------------------------------------- Wrong module size !!!";
1401 
1402                 float tmp1 = theGeomDet->surface().toGlobal(Local3DPoint(0., 0., 0.)).perp();
1403                 float tmp2 = theGeomDet->surface().toGlobal(Local3DPoint(0., 0., 1.)).perp();
1404 
1405                 if (tmp2 < tmp1) {  // flipped
1406                   mePosxBarrelFlippedLadders->Fill(rechitx);
1407                   mePosyBarrelFlippedLadders->Fill(rechity);
1408                   flipped = 1;
1409 
1410                   meResXvsAlphaBarrelFlippedLadders->Fill(alpha, fabs(rechitresx));
1411                   meResYvsAlphaBarrelFlippedLadders->Fill(alpha, fabs(rechitresy));
1412                   meResXvsBetaBarrelFlippedLadders->Fill(beta, fabs(rechitresx));
1413                   meResYvsBetaBarrelFlippedLadders->Fill(beta, fabs(rechitresy));
1414                   mePullXvsAlphaBarrelFlippedLadders->Fill(alpha, rechitpullx);
1415                   mePullYvsAlphaBarrelFlippedLadders->Fill(alpha, rechitpully);
1416                   mePullXvsBetaBarrelFlippedLadders->Fill(beta, rechitpullx);
1417                   mePullYvsBetaBarrelFlippedLadders->Fill(beta, rechitpully);
1418                   mePullXvsPhiBarrelFlippedLadders->Fill(phi, rechitpullx);
1419                   mePullYvsPhiBarrelFlippedLadders->Fill(phi, rechitpully);
1420                   mePullXvsEtaBarrelFlippedLadders->Fill(eta, rechitpullx);
1421                   mePullYvsEtaBarrelFlippedLadders->Fill(eta, rechitpully);
1422 
1423                   meWPullXvsAlphaBarrelFlippedLadders->Fill(alpha, fabs(rechitpullx));
1424                   meWPullYvsAlphaBarrelFlippedLadders->Fill(alpha, fabs(rechitpully));
1425                   meWPullXvsBetaBarrelFlippedLadders->Fill(beta, fabs(rechitpullx));
1426                   meWPullYvsBetaBarrelFlippedLadders->Fill(beta, fabs(rechitpully));
1427                 } else {  // not flipped
1428                   mePosxBarrelNonFlippedLadders->Fill(rechitx);
1429                   mePosyBarrelNonFlippedLadders->Fill(rechity);
1430                   flipped = 0;
1431 
1432                   meResXvsAlphaBarrelNonFlippedLadders->Fill(alpha, fabs(rechitresx));
1433                   meResYvsAlphaBarrelNonFlippedLadders->Fill(alpha, fabs(rechitresy));
1434                   meResXvsBetaBarrelNonFlippedLadders->Fill(beta, fabs(rechitresx));
1435                   meResYvsBetaBarrelNonFlippedLadders->Fill(beta, fabs(rechitresy));
1436                   mePullXvsAlphaBarrelNonFlippedLadders->Fill(alpha, rechitpullx);
1437                   mePullYvsAlphaBarrelNonFlippedLadders->Fill(alpha, rechitpully);
1438                   mePullXvsBetaBarrelNonFlippedLadders->Fill(beta, rechitpullx);
1439                   mePullYvsBetaBarrelNonFlippedLadders->Fill(beta, rechitpully);
1440                   mePullXvsPhiBarrelNonFlippedLadders->Fill(phi, rechitpullx);
1441                   mePullYvsPhiBarrelNonFlippedLadders->Fill(phi, rechitpully);
1442                   mePullXvsEtaBarrelNonFlippedLadders->Fill(eta, rechitpullx);
1443                   mePullYvsEtaBarrelNonFlippedLadders->Fill(eta, rechitpully);
1444 
1445                   meWPullXvsAlphaBarrelNonFlippedLadders->Fill(alpha, fabs(rechitpullx));
1446                   meWPullYvsAlphaBarrelNonFlippedLadders->Fill(alpha, fabs(rechitpully));
1447                   meWPullXvsBetaBarrelNonFlippedLadders->Fill(beta, fabs(rechitpullx));
1448                   meWPullYvsBetaBarrelNonFlippedLadders->Fill(beta, fabs(rechitpully));
1449                 }
1450 
1451                 layer = tTopo->pxbLayer(detId);    // Layer: 1,2,3.
1452                 ladder = tTopo->pxbLadder(detId);  // Ladder: 1-20, 32, 44.
1453                 mod = tTopo->pxbModule(detId);     // Mod: 1-8.
1454 
1455                 mePosxBarrelLayerModule[layer - 1][mod - 1]->Fill(rechitx);
1456                 mePosyBarrelLayerModule[layer - 1][mod - 1]->Fill(rechity);
1457                 meErrxBarrelLayerModule[layer - 1][mod - 1]->Fill(rechiterrx);
1458                 meErryBarrelLayerModule[layer - 1][mod - 1]->Fill(rechiterry);
1459                 meResxBarrelLayerModule[layer - 1][mod - 1]->Fill(rechitresx);
1460                 meResyBarrelLayerModule[layer - 1][mod - 1]->Fill(rechitresy);
1461                 mePullxBarrelLayerModule[layer - 1][mod - 1]->Fill(rechitpullx);
1462                 mePullyBarrelLayerModule[layer - 1][mod - 1]->Fill(rechitpully);
1463                 meNpixBarrelLayerModule[layer - 1][mod - 1]->Fill(npix);
1464                 meNxpixBarrelLayerModule[layer - 1][mod - 1]->Fill(nxpix);
1465                 meNypixBarrelLayerModule[layer - 1][mod - 1]->Fill(nypix);
1466                 meChargeBarrelLayerModule[layer - 1][mod - 1]->Fill(charge);
1467                 meResXvsAlphaBarrelLayerModule[layer - 1][mod - 1]->Fill(alpha, fabs(rechitresx));
1468                 meResYvsAlphaBarrelLayerModule[layer - 1][mod - 1]->Fill(alpha, fabs(rechitresy));
1469                 meResXvsBetaBarrelLayerModule[layer - 1][mod - 1]->Fill(beta, fabs(rechitresx));
1470                 meResYvsBetaBarrelLayerModule[layer - 1][mod - 1]->Fill(beta, fabs(rechitresy));
1471                 mePullXvsAlphaBarrelLayerModule[layer - 1][mod - 1]->Fill(alpha, rechitpullx);
1472                 mePullYvsAlphaBarrelLayerModule[layer - 1][mod - 1]->Fill(alpha, rechitpully);
1473                 mePullXvsBetaBarrelLayerModule[layer - 1][mod - 1]->Fill(beta, rechitpullx);
1474                 mePullYvsBetaBarrelLayerModule[layer - 1][mod - 1]->Fill(beta, rechitpully);
1475                 mePullXvsPhiBarrelLayerModule[layer - 1][mod - 1]->Fill(phi, rechitpullx);
1476                 mePullYvsPhiBarrelLayerModule[layer - 1][mod - 1]->Fill(phi, rechitpully);
1477                 mePullXvsEtaBarrelLayerModule[layer - 1][mod - 1]->Fill(eta, rechitpullx);
1478                 mePullYvsEtaBarrelLayerModule[layer - 1][mod - 1]->Fill(eta, rechitpully);
1479 
1480                 meResxBarrelLayer[layer - 1]->Fill(rechitresx);
1481                 meResyBarrelLayer[layer - 1]->Fill(rechitresy);
1482                 mePullxBarrelLayer[layer - 1]->Fill(rechitpullx);
1483                 mePullyBarrelLayer[layer - 1]->Fill(rechitpully);
1484 
1485                 if (tmp2 < tmp1) {  // flipped
1486                   meResXvsAlphaBarrelFlippedLaddersLayer[layer - 1]->Fill(alpha, fabs(rechitresx));
1487                   meResYvsAlphaBarrelFlippedLaddersLayer[layer - 1]->Fill(alpha, fabs(rechitresy));
1488                   meResXvsBetaBarrelFlippedLaddersLayer[layer - 1]->Fill(beta, fabs(rechitresx));
1489                   meResYvsBetaBarrelFlippedLaddersLayer[layer - 1]->Fill(beta, fabs(rechitresy));
1490                 } else {  // not flipped
1491                   meResXvsAlphaBarrelNonFlippedLaddersLayer[layer - 1]->Fill(alpha, fabs(rechitresx));
1492                   meResYvsAlphaBarrelNonFlippedLaddersLayer[layer - 1]->Fill(alpha, fabs(rechitresy));
1493                   meResXvsBetaBarrelNonFlippedLaddersLayer[layer - 1]->Fill(beta, fabs(rechitresx));
1494                   meResYvsBetaBarrelNonFlippedLaddersLayer[layer - 1]->Fill(beta, fabs(rechitresy));
1495                 }
1496 
1497               } else if ((int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap) {
1498                 side = tTopo->pxfSide(detId);
1499                 disk = tTopo->pxfDisk(detId);
1500                 blade = tTopo->pxfBlade(detId);
1501                 panel = tTopo->pxfPanel(detId);
1502                 plaq = tTopo->pxfModule(detId);  // also known as plaquette
1503 
1504                 if (side == 1) {
1505                   if (panel == 1) {
1506                     mePosxZmPanel1->Fill(rechitx);
1507                     mePosyZmPanel1->Fill(rechity);
1508                     meErrxZmPanel1->Fill(rechiterrx);
1509                     meErryZmPanel1->Fill(rechiterry);
1510                     meResxZmPanel1->Fill(rechitresx);
1511                     meResyZmPanel1->Fill(rechitresy);
1512                     mePullxZmPanel1->Fill(rechitpullx);
1513                     mePullyZmPanel1->Fill(rechitpully);
1514                     meNpixZmPanel1->Fill(npix);
1515                     meNxpixZmPanel1->Fill(nxpix);
1516                     meNypixZmPanel1->Fill(nypix);
1517                     meChargeZmPanel1->Fill(charge);
1518                     meResXvsAlphaZmPanel1->Fill(alpha, fabs(rechitresx));
1519                     meResYvsAlphaZmPanel1->Fill(alpha, fabs(rechitresy));
1520                     meResXvsBetaZmPanel1->Fill(beta, fabs(rechitresx));
1521                     meResYvsBetaZmPanel1->Fill(beta, fabs(rechitresy));
1522                     mePullXvsAlphaZmPanel1->Fill(alpha, rechitpullx);
1523                     mePullYvsAlphaZmPanel1->Fill(alpha, rechitpully);
1524                     mePullXvsBetaZmPanel1->Fill(beta, rechitpullx);
1525                     mePullYvsBetaZmPanel1->Fill(beta, rechitpully);
1526                     mePullXvsPhiZmPanel1->Fill(phi, rechitpullx);
1527                     mePullYvsPhiZmPanel1->Fill(phi, rechitpully);
1528                     mePullXvsEtaZmPanel1->Fill(eta, rechitpullx);
1529                     mePullYvsEtaZmPanel1->Fill(eta, rechitpully);
1530 
1531                     meWPullXvsAlphaZmPanel1->Fill(alpha, fabs(rechitpullx));
1532                     meWPullYvsAlphaZmPanel1->Fill(alpha, fabs(rechitpully));
1533                     meWPullXvsBetaZmPanel1->Fill(beta, fabs(rechitpullx));
1534                     meWPullYvsBetaZmPanel1->Fill(beta, fabs(rechitpully));
1535 
1536                     mePosxZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitx);
1537                     mePosyZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechity);
1538                     meErrxZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterrx);
1539                     meErryZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterry);
1540                     meResxZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresx);
1541                     meResyZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresy);
1542                     mePullxZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpullx);
1543                     mePullyZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpully);
1544                     meNpixZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(npix);
1545                     meNxpixZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(nxpix);
1546                     meNypixZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(nypix);
1547                     meChargeZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(charge);
1548                     meResXvsAlphaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresx));
1549                     meResYvsAlphaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresy));
1550                     meResXvsBetaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresx));
1551                     meResYvsBetaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresy));
1552                     mePullXvsAlphaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpullx);
1553                     mePullYvsAlphaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpully);
1554                     mePullXvsBetaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpullx);
1555                     mePullYvsBetaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpully);
1556                     mePullXvsPhiZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpullx);
1557                     mePullYvsPhiZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpully);
1558                     mePullXvsEtaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpullx);
1559                     mePullYvsEtaZmPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpully);
1560 
1561                   } else if (panel == 2) {
1562                     mePosxZmPanel2->Fill(rechitx);
1563                     mePosyZmPanel2->Fill(rechity);
1564                     meErrxZmPanel2->Fill(rechiterrx);
1565                     meErryZmPanel2->Fill(rechiterry);
1566                     meResxZmPanel2->Fill(rechitresx);
1567                     meResyZmPanel2->Fill(rechitresy);
1568                     mePullxZmPanel2->Fill(rechitpullx);
1569                     mePullyZmPanel2->Fill(rechitpully);
1570                     meNpixZmPanel2->Fill(npix);
1571                     meNxpixZmPanel2->Fill(nxpix);
1572                     meNypixZmPanel2->Fill(nypix);
1573                     meChargeZmPanel2->Fill(charge);
1574                     meResXvsAlphaZmPanel2->Fill(alpha, fabs(rechitresx));
1575                     meResYvsAlphaZmPanel2->Fill(alpha, fabs(rechitresy));
1576                     meResXvsBetaZmPanel2->Fill(beta, fabs(rechitresx));
1577                     meResYvsBetaZmPanel2->Fill(beta, fabs(rechitresy));
1578                     mePullXvsAlphaZmPanel2->Fill(alpha, rechitpullx);
1579                     mePullYvsAlphaZmPanel2->Fill(alpha, rechitpully);
1580                     mePullXvsBetaZmPanel2->Fill(beta, rechitpullx);
1581                     mePullYvsBetaZmPanel2->Fill(beta, rechitpully);
1582                     mePullXvsPhiZmPanel2->Fill(phi, rechitpullx);
1583                     mePullYvsPhiZmPanel2->Fill(phi, rechitpully);
1584                     mePullXvsEtaZmPanel2->Fill(eta, rechitpullx);
1585                     mePullYvsEtaZmPanel2->Fill(eta, rechitpully);
1586 
1587                     meWPullXvsAlphaZmPanel2->Fill(alpha, fabs(rechitpullx));
1588                     meWPullYvsAlphaZmPanel2->Fill(alpha, fabs(rechitpully));
1589                     meWPullXvsBetaZmPanel2->Fill(beta, fabs(rechitpullx));
1590                     meWPullYvsBetaZmPanel2->Fill(beta, fabs(rechitpully));
1591 
1592                     mePosxZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitx);
1593                     mePosyZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechity);
1594                     meErrxZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterrx);
1595                     meErryZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterry);
1596                     meResxZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresx);
1597                     meResyZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresy);
1598                     mePullxZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpullx);
1599                     mePullyZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpully);
1600                     meNpixZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(npix);
1601                     meNxpixZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(nxpix);
1602                     meNypixZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(nypix);
1603                     meChargeZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(charge);
1604                     meResXvsAlphaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresx));
1605                     meResYvsAlphaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresy));
1606                     meResXvsBetaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresx));
1607                     meResYvsBetaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresy));
1608                     mePullXvsAlphaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpullx);
1609                     mePullYvsAlphaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpully);
1610                     mePullXvsBetaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpullx);
1611                     mePullYvsBetaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpully);
1612                     mePullXvsPhiZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpullx);
1613                     mePullYvsPhiZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpully);
1614                     mePullXvsEtaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpullx);
1615                     mePullYvsEtaZmPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpully);
1616 
1617                   } else
1618                     edm::LogWarning("SiPixelTrackingRecHitsValid")
1619                         << "..............................................Wrong panel number !";
1620                 }  // if ( side==1 )
1621                 else if (side == 2) {
1622                   if (panel == 1) {
1623                     mePosxZpPanel1->Fill(rechitx);
1624                     mePosyZpPanel1->Fill(rechity);
1625                     meErrxZpPanel1->Fill(rechiterrx);
1626                     meErryZpPanel1->Fill(rechiterry);
1627                     meResxZpPanel1->Fill(rechitresx);
1628                     meResyZpPanel1->Fill(rechitresy);
1629                     mePullxZpPanel1->Fill(rechitpullx);
1630                     mePullyZpPanel1->Fill(rechitpully);
1631                     meNpixZpPanel1->Fill(npix);
1632                     meNxpixZpPanel1->Fill(nxpix);
1633                     meNypixZpPanel1->Fill(nypix);
1634                     meChargeZpPanel1->Fill(charge);
1635                     meResXvsAlphaZpPanel1->Fill(alpha, fabs(rechitresx));
1636                     meResYvsAlphaZpPanel1->Fill(alpha, fabs(rechitresy));
1637                     meResXvsBetaZpPanel1->Fill(beta, fabs(rechitresx));
1638                     meResYvsBetaZpPanel1->Fill(beta, fabs(rechitresy));
1639                     mePullXvsAlphaZpPanel1->Fill(alpha, rechitpullx);
1640                     mePullYvsAlphaZpPanel1->Fill(alpha, rechitpully);
1641                     mePullXvsBetaZpPanel1->Fill(beta, rechitpullx);
1642                     mePullYvsBetaZpPanel1->Fill(beta, rechitpully);
1643                     mePullXvsPhiZpPanel1->Fill(phi, rechitpullx);
1644                     mePullYvsPhiZpPanel1->Fill(phi, rechitpully);
1645                     mePullXvsEtaZpPanel1->Fill(eta, rechitpullx);
1646                     mePullYvsEtaZpPanel1->Fill(eta, rechitpully);
1647 
1648                     meWPullXvsAlphaZpPanel1->Fill(alpha, fabs(rechitpullx));
1649                     meWPullYvsAlphaZpPanel1->Fill(alpha, fabs(rechitpully));
1650                     meWPullXvsBetaZpPanel1->Fill(beta, fabs(rechitpullx));
1651                     meWPullYvsBetaZpPanel1->Fill(beta, fabs(rechitpully));
1652 
1653                     mePosxZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitx);
1654                     mePosyZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechity);
1655                     meErrxZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterrx);
1656                     meErryZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterry);
1657                     meResxZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresx);
1658                     meResyZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresy);
1659                     mePullxZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpullx);
1660                     mePullyZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpully);
1661                     meNpixZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(npix);
1662                     meNxpixZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(nxpix);
1663                     meNypixZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(nypix);
1664                     meChargeZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(charge);
1665                     meResXvsAlphaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresx));
1666                     meResYvsAlphaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresy));
1667                     meResXvsBetaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresx));
1668                     meResYvsBetaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresy));
1669                     mePullXvsAlphaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpullx);
1670                     mePullYvsAlphaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpully);
1671                     mePullXvsBetaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpullx);
1672                     mePullYvsBetaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpully);
1673                     mePullXvsPhiZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpullx);
1674                     mePullYvsPhiZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpully);
1675                     mePullXvsEtaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpullx);
1676                     mePullYvsEtaZpPanel1DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpully);
1677 
1678                   } else if (panel == 2) {
1679                     mePosxZpPanel2->Fill(rechitx);
1680                     mePosyZpPanel2->Fill(rechity);
1681                     meErrxZpPanel2->Fill(rechiterrx);
1682                     meErryZpPanel2->Fill(rechiterry);
1683                     meResxZpPanel2->Fill(rechitresx);
1684                     meResyZpPanel2->Fill(rechitresy);
1685                     mePullxZpPanel2->Fill(rechitpullx);
1686                     mePullyZpPanel2->Fill(rechitpully);
1687                     meNpixZpPanel2->Fill(npix);
1688                     meNxpixZpPanel2->Fill(nxpix);
1689                     meNypixZpPanel2->Fill(nypix);
1690                     meChargeZpPanel2->Fill(charge);
1691                     meResXvsAlphaZpPanel2->Fill(alpha, fabs(rechitresx));
1692                     meResYvsAlphaZpPanel2->Fill(alpha, fabs(rechitresy));
1693                     meResXvsBetaZpPanel2->Fill(beta, fabs(rechitresx));
1694                     meResYvsBetaZpPanel2->Fill(beta, fabs(rechitresy));
1695                     mePullXvsAlphaZpPanel2->Fill(alpha, rechitpullx);
1696                     mePullYvsAlphaZpPanel2->Fill(alpha, rechitpully);
1697                     mePullXvsBetaZpPanel2->Fill(beta, rechitpullx);
1698                     mePullYvsBetaZpPanel2->Fill(beta, rechitpully);
1699                     mePullXvsPhiZpPanel2->Fill(phi, rechitpullx);
1700                     mePullYvsPhiZpPanel2->Fill(phi, rechitpully);
1701                     mePullXvsEtaZpPanel2->Fill(eta, rechitpullx);
1702                     mePullYvsEtaZpPanel2->Fill(eta, rechitpully);
1703 
1704                     meWPullXvsAlphaZpPanel2->Fill(alpha, fabs(rechitpullx));
1705                     meWPullYvsAlphaZpPanel2->Fill(alpha, fabs(rechitpully));
1706                     meWPullXvsBetaZpPanel2->Fill(beta, fabs(rechitpullx));
1707                     meWPullYvsBetaZpPanel2->Fill(beta, fabs(rechitpully));
1708 
1709                     mePosxZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitx);
1710                     mePosyZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechity);
1711                     meErrxZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterrx);
1712                     meErryZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechiterry);
1713                     meResxZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresx);
1714                     meResyZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitresy);
1715                     mePullxZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpullx);
1716                     mePullyZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(rechitpully);
1717                     meNpixZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(npix);
1718                     meNxpixZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(nxpix);
1719                     meNypixZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(nypix);
1720                     meChargeZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(charge);
1721                     meResXvsAlphaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresx));
1722                     meResYvsAlphaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, fabs(rechitresy));
1723                     meResXvsBetaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresx));
1724                     meResYvsBetaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, fabs(rechitresy));
1725                     mePullXvsAlphaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpullx);
1726                     mePullYvsAlphaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(alpha, rechitpully);
1727                     mePullXvsBetaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpullx);
1728                     mePullYvsBetaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(beta, rechitpully);
1729                     mePullXvsPhiZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpullx);
1730                     mePullYvsPhiZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(phi, rechitpully);
1731                     mePullXvsEtaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpullx);
1732                     mePullYvsEtaZpPanel2DiskPlaq[disk - 1][plaq - 1]->Fill(eta, rechitpully);
1733 
1734                   } else
1735                     edm::LogWarning("SiPixelTrackingRecHitsValid")
1736                         << "..............................................Wrong panel number !";
1737                 }  //else if ( side==2 )
1738                 else
1739                   edm::LogWarning("SiPixelTrackingRecHitsValid")
1740                       << ".......................................................Wrong side !";
1741 
1742               }  // else if ( detId.subdetId()==PixelSubdetector::PixelEndcap )
1743               else
1744                 edm::LogWarning("SiPixelTrackingRecHitsValid")
1745                     << "Pixel rechit but we are not in the pixel detector" << (int)detId.subdetId();
1746 
1747               if (!debugNtuple_.empty())
1748                 t_->Fill();
1749 
1750             }  // if ( !matched.empty() )
1751             //else
1752             //cout << "---------------- RecHit with no associated SimHit !!! -------------------------- " << endl;
1753 
1754           }  // matchedhit.
1755 
1756         }  // end of loop on hits
1757 
1758         mePixRecHitsPerTrack->Fill(n_hits);
1759         //cout << "n_hits = " << n_hits << endl;
1760 
1761       }  //end of loop on track
1762 
1763     }  // tracks > 0.
1764 
1765   }  //end of MTCCTrack
1766 }