CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Validation/RecoTrack/plugins/SiPixelTrackingRecHitsValid.cc

Go to the documentation of this file.
00001 
00002 // File: SiPixelTrackingRecHitsValid.cc
00003 // Authors:  Xingtao Huang (Puerto Rico Univ.)
00004 //           Gavril Giurgiu (JHU)
00005 // Creation Date: Oct. 2006
00006 
00007 #include <memory>
00008 #include <string>
00009 #include <iostream>
00010 #include <TMath.h>
00011 #include "Validation/RecoTrack/interface/SiPixelTrackingRecHitsValid.h"
00012 
00013 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00014 #include "FWCore/Framework/interface/ESHandle.h"
00015 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00016 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00017 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00018 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00019 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00020 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
00021 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00022 
00023 #include "DataFormats/TrackReco/interface/Track.h"
00024 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00025 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00026 #include "DataFormats/DetId/interface/DetId.h" 
00027 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00028 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00029 
00030 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
00031 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00032 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00033 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00034 
00035 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00036 
00037 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
00038 
00039 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00040 
00041 #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyBuilder.h"
00042 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00043 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00044 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00045 
00046 
00047 #include <TTree.h>
00048 #include <TFile.h>
00049 
00050 using namespace std;
00051 using namespace edm;
00052 
00053 // End job: write and close the ntuple file
00054 void SiPixelTrackingRecHitsValid::endJob() 
00055 {
00056   if(debugNtuple_.size()!=0){
00057   tfile_->Write();
00058   tfile_->Close();
00059   }
00060 }
00061 
00062 void SiPixelTrackingRecHitsValid::beginJob()
00063 {
00064 
00065   if(debugNtuple_.size()!=0){
00066     tfile_ = new TFile (debugNtuple_.c_str() , "RECREATE");
00067     
00068     t_ = new TTree("Ntuple", "Ntuple");
00069     int bufsize = 64000;
00070   
00071     t_->Branch("subdetId", &subdetId, "subdetId/I", bufsize);
00072   
00073     t_->Branch("layer" , &layer , "layer/I" , bufsize);
00074     t_->Branch("ladder", &ladder, "ladder/I", bufsize);
00075     t_->Branch("mod"   , &mod   , "mod/I"   , bufsize);
00076     t_->Branch("side"  , &side  , "side/I"  , bufsize);
00077     t_->Branch("disk"  , &disk  , "disk/I"  , bufsize);
00078     t_->Branch("blade" , &blade , "blade/I" , bufsize);
00079     t_->Branch("panel" , &panel , "panel/I" , bufsize);
00080     t_->Branch("plaq"  , &plaq  , "plaq/I"  , bufsize);
00081     
00082     t_->Branch("rechitx"    , &rechitx    , "rechitx/F"    , bufsize);
00083     t_->Branch("rechity"    , &rechity    , "rechity/F"    , bufsize);
00084     t_->Branch("rechitz"    , &rechitz    , "rechitz/F"    , bufsize);
00085     t_->Branch("rechiterrx" , &rechiterrx , "rechiterrx/F" , bufsize);
00086     t_->Branch("rechiterry" , &rechiterry , "rechiterry/F" , bufsize);
00087     t_->Branch("rechitresx" , &rechitresx , "rechitresx/F" , bufsize);
00088     t_->Branch("rechitresy" , &rechitresy , "rechitresy/F" , bufsize);
00089     t_->Branch("rechitpullx", &rechitpullx, "rechitpullx/F", bufsize);
00090     t_->Branch("rechitpully", &rechitpully, "rechitpully/F", bufsize);
00091     
00092     t_->Branch("npix"  , &npix  , "npix/I"  , bufsize);
00093     t_->Branch("nxpix" , &nxpix , "nxpix/I" , bufsize);
00094     t_->Branch("nypix" , &nypix , "nypix/I" , bufsize);
00095     t_->Branch("charge", &charge, "charge/F", bufsize);
00096     
00097     t_->Branch("alpha", &alpha, "alpha/F", bufsize);
00098     t_->Branch("beta" , &beta , "beta/F" , bufsize);
00099     
00100     t_->Branch("phi", &phi, "phi/F", bufsize);
00101     t_->Branch("eta", &eta, "eta/F", bufsize);
00102     
00103     t_->Branch("half"   , &half   , "half/I"   , bufsize);
00104     t_->Branch("flipped", &flipped, "flipped/I", bufsize);
00105     
00106     t_->Branch("simhitx", &simhitx, "simhitx/F", bufsize);
00107     t_->Branch("simhity", &simhity, "simhity/F", bufsize);
00108 
00109     t_->Branch("nsimhit", &nsimhit, "nsimhit/I", bufsize);
00110     t_->Branch("pidhit" , &pidhit , "pidhit/I" , bufsize);
00111     
00112     t_->Branch("evt", &evt, "evt/I", bufsize);
00113     t_->Branch("run", &run, "run/I", bufsize);
00114   }
00115   
00116 }
00117 
00118 SiPixelTrackingRecHitsValid::SiPixelTrackingRecHitsValid(const ParameterSet& ps):conf_(ps), dbe_(0), tfile_(0), t_(0)
00119 {
00120   //Read config file
00121   MTCCtrack_ = ps.getParameter<bool>("MTCCtrack");
00122   outputFile_ = ps.getUntrackedParameter<string>("outputFile", "pixeltrackingrechitshisto.root");
00123   src_ = ps.getUntrackedParameter<std::string>( "src" );
00124   builderName_ = ps.getParameter<std::string>("TTRHBuilder");   
00125   checkType_ = ps.getParameter<bool>("checkType");
00126   genType_ = ps.getParameter<int>("genType");
00127   debugNtuple_=ps.getUntrackedParameter<string>("debugNtuple", "SiPixelTrackingRecHitsValid_Ntuple.root");
00128 
00129   // Book histograms
00130   dbe_ = Service<DQMStore>().operator->();
00131   //dbe_->showDirStructure();
00132 
00133   //float math_pi = 3.14159265;
00134   //float radtodeg = 180.0 / math_pi;
00135 
00136   // Histogram ranges (low and high)
00137 
00138   float xl = -1.0; 
00139   float xh =  1.0;
00140   float errxl = 0.0;
00141   float errxh = 0.003;
00142   float resxl = -0.02;
00143   float resxh =  0.02;
00144   float pullxl = -10.0;
00145   float pullxh =  10.0;
00146   
00147   float yl = -4.0;
00148   float yh =  4.0;
00149   float erryl = 0.0;
00150   float erryh = 0.010;
00151   float resyl = -0.04;
00152   float resyh =  0.04;
00153   float pullyl = -10.0;
00154   float pullyh =  10.0;
00155 
00156   float barrel_alphal =  80.0;
00157   float barrel_alphah = 100.0;
00158   float barrel_betal =  10.0;
00159   float barrel_betah = 170.0;
00160   //float barrel_phil = -180.0;
00161   //float barrel_phih =  180.0;
00162   //float barrel_etal = -2.5;
00163   //float barrel_etah =  2.5;
00164 
00165   float forward_p1_alphal = 100.0; 
00166   float forward_p1_alphah = 115.0;
00167   float forward_p2_alphal =  65.0; 
00168   float forward_p2_alphah =  80.0;
00169   float forward_neg_betal = 67.0; 
00170   float forward_neg_betah = 73.0;
00171   float forward_pos_betal = 107.0;
00172   float forward_pos_betah = 113.0;
00173   //float forward_phil = -180.0;
00174   //float forward_phih =  180.0;
00175   //float forward_neg_etal = -2.5;
00176   //float forward_neg_etah = -1.5;
00177   //float forward_pos_etal = 1.5;
00178   //float forward_pos_etah = 2.5;
00179 
00180   // special ranges for pulls
00181   float pull_barrel_alphal =  80.0;
00182   float pull_barrel_alphah = 100.0;
00183   float pull_barrel_betal =  10.0;
00184   float pull_barrel_betah = 170.0;
00185   float pull_barrel_phil = -180.0;
00186   float pull_barrel_phih =  180.0;
00187   float pull_barrel_etal = -2.4;
00188   float pull_barrel_etah =  2.4;
00189 
00190   float pull_forward_p1_alphal = 100.0; 
00191   float pull_forward_p1_alphah = 112.0;
00192   float pull_forward_p2_alphal =  68.0; 
00193   float pull_forward_p2_alphah =  80.0;
00194   float pull_forward_neg_betal = 68.0; 
00195   float pull_forward_neg_betah = 72.0;
00196   float pull_forward_pos_betal = 108.0;
00197   float pull_forward_pos_betah = 112.0;
00198   float pull_forward_phil = -180.0;
00199   float pull_forward_phih =  180.0;
00200   float pull_forward_neg_etal = -2.4;
00201   float pull_forward_neg_etah = -1.4;
00202   float pull_forward_pos_etal = 1.5;
00203   float pull_forward_pos_etah = 2.5;
00204     
00205   int npixl = 0;
00206   int npixh = 20;
00207   int nxpixl = 0;
00208   int nxpixh = 10;
00209   int nypixl = 0;
00210   int nypixh = 20;
00211 
00212   float barrel_chargel = 0.0;
00213   float barrel_chargeh = 250000.0;
00214   float forward_chargel = 0.0;
00215   float forward_chargeh = 100000.0;
00216 
00217   dbe_->setCurrentFolder("Tracking/TrackingRecHits/Pixel/Histograms_per_ring-layer_or_disk-plaquette");
00218 
00219   // Pixel barrel has 3 layers and 8 rings; book a histogram for each module given by the (layer, ring) pair 
00220   for (int i=0; i<3 ; i++) // loop over layers
00221     {
00222       Char_t chisto[100];
00223 
00224       sprintf(chisto, "meResxBarrelLayer_%d", i+1);
00225       meResxBarrelLayer[i] = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00226       sprintf(chisto, "meResyBarrelLayer_%d", i+1);
00227       meResyBarrelLayer[i] = dbe_->book1D(chisto, chisto, 100, resyl, resyh);   
00228       sprintf(chisto, "mePullxBarrelLayer_%d", i+1);
00229       mePullxBarrelLayer[i] = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00230       sprintf(chisto, "mePullyBarrelLayer_%d", i+1);
00231       mePullyBarrelLayer[i] = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);        
00232 
00233       sprintf(chisto, "meResXvsAlphaBarrelFlippedLaddersLayer_%d", i+1);
00234       meResXvsAlphaBarrelFlippedLaddersLayer[i] = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
00235       sprintf(chisto, "meResYvsAlphaBarrelFlippedLaddersLayer_%d", i+1);
00236       meResYvsAlphaBarrelFlippedLaddersLayer[i] = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
00237       sprintf(chisto, "meResXvsBetaBarrelFlippedLaddersLayer_%d", i+1);
00238       meResXvsBetaBarrelFlippedLaddersLayer[i] = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
00239       sprintf(chisto, "meResYvsBetaBarrelFlippedLaddersLayer_%d", i+1);
00240       meResYvsBetaBarrelFlippedLaddersLayer[i] = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, ""); 
00241       
00242       sprintf(chisto, "meResXvsAlphaBarrelNonFlippedLaddersLayer_%d", i+1);
00243       meResXvsAlphaBarrelNonFlippedLaddersLayer[i] 
00244         = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
00245       sprintf(chisto, "meResYvsAlphaBarrelNonFlippedLaddersLayer_%d", i+1);
00246       meResYvsAlphaBarrelNonFlippedLaddersLayer[i] 
00247         = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
00248       sprintf(chisto, "meResXvsBetaBarrelNonFlippedLaddersLayer_%d", i+1);
00249       meResXvsBetaBarrelNonFlippedLaddersLayer[i] 
00250         = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
00251       sprintf(chisto, "meResYvsBetaBarrelNonFlippedLaddersLayer_%d", i+1);
00252       meResYvsBetaBarrelNonFlippedLaddersLayer[i] 
00253         = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, ""); 
00254 
00255       for (int j=0; j<8; j++) // loop over rings
00256         {
00257           sprintf(chisto, "mePosxBarrelLayerModule_%d_%d", i+1, j+1);
00258           mePosxBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, xl, xh);
00259           sprintf(chisto, "mePosyBarrelLayerModule_%d_%d", i+1, j+1); 
00260           mePosyBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, yl, yh);
00261           sprintf(chisto, "meErrxBarrelLayerModule_%d_%d", i+1, j+1);
00262           meErrxBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00263           sprintf(chisto, "meErryBarrelLayerModule_%d_%d", i+1, j+1);
00264           meErryBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, erryl, erryh);      
00265           sprintf(chisto, "meResxBarrelLayerModule_%d_%d", i+1, j+1);
00266           meResxBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00267           sprintf(chisto, "meResyBarrelLayerModule_%d_%d", i+1, j+1);
00268           meResyBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, resyl, resyh);      
00269           sprintf(chisto, "mePullxBarrelLayerModule_%d_%d", i+1, j+1);
00270           mePullxBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00271           sprintf(chisto, "mePullyBarrelLayerModule_%d_%d", i+1, j+1);
00272           mePullyBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);   
00273           sprintf(chisto, "meNpixBarrelLayerModule_%d_%d", i+1, j+1);
00274           meNpixBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, npixl, npixh);
00275           sprintf(chisto, "meNxpixBarrelLayerModule_%d_%d", i+1, j+1);
00276           meNxpixBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);
00277           sprintf(chisto, "meNypixBarrelLayerModule_%d_%d", i+1, j+1);
00278           meNypixBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);
00279           sprintf(chisto, "meChargeBarrelLayerModule_%d_%d", i+1, j+1);
00280           meChargeBarrelLayerModule[i][j] = dbe_->book1D(chisto, chisto, 100, barrel_chargel, barrel_chargeh);
00281           
00282           sprintf(chisto, "meResXvsAlphaBarrelLayerModule_%d_%d", i+1, j+1);
00283           meResXvsAlphaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
00284           sprintf(chisto, "meResYvsAlphaBarrelLayerModule_%d_%d", i+1, j+1);
00285           meResYvsAlphaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");
00286           sprintf(chisto, "meResXvsBetaBarrelLayerModule_%d_%d", i+1, j+1);
00287           meResXvsBetaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
00288           sprintf(chisto, "meResYvsBetaBarrelLayerModule_%d_%d", i+1, j+1);
00289           meResYvsBetaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, ""); 
00290           
00291           sprintf(chisto, "mePullXvsAlphaBarrelLayerModule_%d_%d", i+1, j+1);
00292           mePullXvsAlphaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 
00293                                                                     100, pullxl, pullxh, "");
00294           sprintf(chisto, "mePullYvsAlphaBarrelLayerModule_%d_%d", i+1, j+1);
00295           mePullYvsAlphaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 
00296                                                                     100, pullyl, pullyh, "");
00297           sprintf(chisto, "mePullXvsBetaBarrelLayerModule_%d_%d", i+1, j+1);
00298           mePullXvsBetaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 
00299                                                                    100, pullxl, pullxh, "");
00300           sprintf(chisto, "mePullYvsBetaBarrelLayerModule_%d_%d", i+1, j+1);
00301           mePullYvsBetaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 
00302                                                                    100, pullyl, pullyh, ""); 
00303           sprintf(chisto, "mePullXvsPhiBarrelLayerModule_%d_%d", i+1, j+1);
00304           mePullXvsPhiBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, 
00305                                                                   pullxl, pullxh, "");
00306           sprintf(chisto, "mePullYvsPhiBarrelLayerModule_%d_%d", i+1, j+1);
00307           mePullYvsPhiBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 
00308                                                                   100, pullyl, pullyh, "");
00309           sprintf(chisto, "mePullXvsEtaBarrelLayerModule_%d_%d", i+1, j+1);
00310           mePullXvsEtaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 
00311                                                                   100, pullxl, pullxh, "");
00312           sprintf(chisto, "mePullYvsEtaBarrelLayerModule_%d_%d", i+1, j+1);
00313           mePullYvsEtaBarrelLayerModule[i][j] = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 
00314                                                                   100, pullyl, pullyh, ""); 
00315         } //  for (int j=0; j<8; j++) // loop over rings
00316       
00317     } // for (int i=0; i<3 ; i++) // loop over layers
00318   
00319   // Pixel forward detector has 2 disks, 2 panels and either 3 or 4 plaquettes
00320   // Panel 1 has 4 plaquettes
00321   // Panel 2 has 3 plaquettes
00322 
00323   // Panel 1: 2 disks, 4 plaquets
00324   // Panel 2: 2 disks, 3 plaquets
00325   for (int i=0; i<2 ; i++) // loop over disks 
00326     for (int j=0; j<4; j++) // loop over plaquettes
00327       {
00328         Char_t chisto[100];
00329 
00330         sprintf(chisto, "mePosxZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00331         mePosxZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, xl, xh);
00332         sprintf(chisto, "mePosyZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00333         mePosyZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, yl, yh);
00334         sprintf(chisto, "meErrxZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00335         meErrxZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00336         sprintf(chisto, "meErryZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00337         meErryZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, erryl, erryh); 
00338         sprintf(chisto, "meResxZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00339         meResxZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00340         sprintf(chisto, "meResyZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00341         meResyZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resyl, resyh); 
00342         sprintf(chisto, "mePullxZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00343         mePullxZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00344         sprintf(chisto, "mePullyZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00345         mePullyZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);      
00346         sprintf(chisto, "meNpixZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00347         meNpixZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, npixl, npixh); 
00348         sprintf(chisto, "meNxpixZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00349         meNxpixZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);      
00350         sprintf(chisto, "meNypixZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00351         meNypixZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);      
00352         sprintf(chisto, "meChargeZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00353         meChargeZmPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);   
00354 
00355         sprintf(chisto, "meResXvsAlphaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00356         meResXvsAlphaZmPanel1DiskPlaq[i][j] 
00357           = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resxh, "");
00358         sprintf(chisto, "meResYvsAlphaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00359         meResYvsAlphaZmPanel1DiskPlaq[i][j] 
00360           = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resyh, "");
00361         sprintf(chisto, "meResXvsBetaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00362         meResXvsBetaZmPanel1DiskPlaq[i][j] 
00363           = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resxh, "");
00364         sprintf(chisto, "meResYvsBetaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00365         meResYvsBetaZmPanel1DiskPlaq[i][j] 
00366           = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resyh, "");
00367 
00368         sprintf(chisto, "mePullXvsAlphaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00369         mePullXvsAlphaZmPanel1DiskPlaq[i][j] 
00370           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl,pullxh, "");
00371         sprintf(chisto, "mePullYvsAlphaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00372         mePullYvsAlphaZmPanel1DiskPlaq[i][j] 
00373           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl,pullyh, "");
00374         sprintf(chisto, "mePullXvsBetaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00375         mePullXvsBetaZmPanel1DiskPlaq[i][j] 
00376           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl,pullxh, "");
00377         sprintf(chisto, "mePullYvsBetaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00378         mePullYvsBetaZmPanel1DiskPlaq[i][j] 
00379           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl,pullyh, "");
00380         sprintf(chisto, "mePullXvsPhiZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00381         mePullXvsPhiZmPanel1DiskPlaq[i][j] 
00382           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,pullxh, "");
00383         sprintf(chisto, "mePullYvsPhiZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00384         mePullYvsPhiZmPanel1DiskPlaq[i][j] 
00385           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,pullyh, "");
00386         sprintf(chisto, "mePullXvsEtaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00387         mePullXvsEtaZmPanel1DiskPlaq[i][j] 
00388           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl,pullxh, "");
00389         sprintf(chisto, "mePullYvsEtaZmPanel1DiskPlaq_%d_%d", i+1, j+1);
00390         mePullYvsEtaZmPanel1DiskPlaq[i][j] 
00391           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl,pullyh, "");
00392 
00393         sprintf(chisto, "mePosxZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00394         mePosxZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, xl, xh);
00395         sprintf(chisto, "mePosyZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00396         mePosyZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, yl, yh);
00397         sprintf(chisto, "meErrxZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00398         meErrxZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00399         sprintf(chisto, "meErryZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00400         meErryZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, erryl, erryh); 
00401         sprintf(chisto, "meResxZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00402         meResxZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00403         sprintf(chisto, "meResyZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00404         meResyZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resyl, resyh); 
00405         sprintf(chisto, "mePullxZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00406         mePullxZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00407         sprintf(chisto, "mePullyZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00408         mePullyZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);      
00409         sprintf(chisto, "meNpixZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00410         meNpixZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, npixl, npixh); 
00411         sprintf(chisto, "meNxpixZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00412         meNxpixZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);      
00413         sprintf(chisto, "meNypixZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00414         meNypixZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);      
00415         sprintf(chisto, "meChargeZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00416         meChargeZpPanel1DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);   
00417         sprintf(chisto, "meResXvsAlphaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00418         meResXvsAlphaZpPanel1DiskPlaq[i][j] 
00419           = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resxh, "");
00420         sprintf(chisto, "meResYvsAlphaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00421         meResYvsAlphaZpPanel1DiskPlaq[i][j] 
00422           = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resyh, "");
00423         sprintf(chisto, "meResXvsBetaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00424         meResXvsBetaZpPanel1DiskPlaq[i][j] 
00425           = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resxh, "");
00426         sprintf(chisto, "meResYvsBetaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00427         meResYvsBetaZpPanel1DiskPlaq[i][j] 
00428           = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resyh, "");
00429 
00430         sprintf(chisto, "mePullXvsAlphaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00431         mePullXvsAlphaZpPanel1DiskPlaq[i][j] 
00432           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl,pullxh, "");
00433         sprintf(chisto, "mePullYvsAlphaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00434         mePullYvsAlphaZpPanel1DiskPlaq[i][j] 
00435           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl,pullyh, "");
00436         sprintf(chisto, "mePullXvsBetaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00437         mePullXvsBetaZpPanel1DiskPlaq[i][j] 
00438           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl,pullxh, "");
00439         sprintf(chisto, "mePullYvsBetaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00440         mePullYvsBetaZpPanel1DiskPlaq[i][j] 
00441           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl,pullyh, "");
00442         sprintf(chisto, "mePullXvsPhiZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00443         mePullXvsPhiZpPanel1DiskPlaq[i][j] 
00444           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,pullxh, "");
00445         sprintf(chisto, "mePullYvsPhiZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00446         mePullYvsPhiZpPanel1DiskPlaq[i][j] 
00447           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,pullyh, "");
00448         sprintf(chisto, "mePullXvsEtaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00449         mePullXvsEtaZpPanel1DiskPlaq[i][j] 
00450           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl,pullxh, "");
00451         sprintf(chisto, "mePullYvsEtaZpPanel1DiskPlaq_%d_%d", i+1, j+1);
00452         mePullYvsEtaZpPanel1DiskPlaq[i][j] 
00453           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl,pullyh, "");
00454         
00455         if ( j>2 ) continue; // panel 2 has only 3 plaquettes
00456         
00457         sprintf(chisto, "mePosxZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00458         mePosxZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, xl, xh);
00459         sprintf(chisto, "mePosyZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00460         mePosyZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, yl, yh);
00461         sprintf(chisto, "meErrxZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00462         meErrxZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00463         sprintf(chisto, "meErryZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00464         meErryZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, erryl, erryh); 
00465         sprintf(chisto, "meResxZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00466         meResxZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00467         sprintf(chisto, "meResyZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00468         meResyZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resyl, resyh); 
00469         sprintf(chisto, "mePullxZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00470         mePullxZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00471         sprintf(chisto, "mePullyZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00472         mePullyZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);      
00473         sprintf(chisto, "meNpixZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00474         meNpixZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, npixl, npixh); 
00475         sprintf(chisto, "meNxpixZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00476         meNxpixZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);      
00477         sprintf(chisto, "meNypixZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00478         meNypixZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);      
00479         sprintf(chisto, "meChargeZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00480         meChargeZmPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);   
00481         sprintf(chisto, "meResXvsAlphaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00482         meResXvsAlphaZmPanel2DiskPlaq[i][j] 
00483           = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resxh, "");
00484         sprintf(chisto, "meResYvsAlphaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00485         meResYvsAlphaZmPanel2DiskPlaq[i][j] 
00486           = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resyh, "");
00487         sprintf(chisto, "meResXvsBetaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00488         meResXvsBetaZmPanel2DiskPlaq[i][j] 
00489           = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resxh, "");
00490         sprintf(chisto, "meResYvsBetaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00491         meResYvsBetaZmPanel2DiskPlaq[i][j] 
00492           = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resyh, ""); 
00493 
00494         sprintf(chisto, "mePullXvsAlphaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00495         mePullXvsAlphaZmPanel2DiskPlaq[i][j] 
00496           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl,pullxh, "");
00497         sprintf(chisto, "mePullYvsAlphaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00498         mePullYvsAlphaZmPanel2DiskPlaq[i][j] 
00499           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl,pullyh, "");
00500         sprintf(chisto, "mePullXvsBetaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00501         mePullXvsBetaZmPanel2DiskPlaq[i][j] 
00502           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl,pullxh, "");
00503         sprintf(chisto, "mePullYvsBetaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00504         mePullYvsBetaZmPanel2DiskPlaq[i][j] 
00505           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl,pullyh, ""); 
00506         sprintf(chisto, "mePullXvsPhiZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00507         mePullXvsPhiZmPanel2DiskPlaq[i][j] 
00508           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,pullxh, "");
00509         sprintf(chisto, "mePullYvsPhiZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00510         mePullYvsPhiZmPanel2DiskPlaq[i][j] 
00511           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,pullyh, "");
00512         sprintf(chisto, "mePullXvsEtaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00513         mePullXvsEtaZmPanel2DiskPlaq[i][j] 
00514           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl, pullxh, "");
00515         sprintf(chisto, "mePullYvsEtaZmPanel2DiskPlaq_%d_%d", i+1, j+1);
00516         mePullYvsEtaZmPanel2DiskPlaq[i][j] 
00517           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl, pullyh, "");
00518  
00519         sprintf(chisto, "mePosxZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00520         mePosxZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, xl, xh);
00521         sprintf(chisto, "mePosyZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00522         mePosyZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, yl, yh);
00523         sprintf(chisto, "meErrxZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00524         meErrxZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00525         sprintf(chisto, "meErryZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00526         meErryZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, erryl, erryh); 
00527         sprintf(chisto, "meResxZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00528         meResxZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00529         sprintf(chisto, "meResyZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00530         meResyZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, resyl, resyh); 
00531         sprintf(chisto, "mePullxZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00532         mePullxZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00533         sprintf(chisto, "mePullyZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00534         mePullyZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);      
00535         sprintf(chisto, "meNpixZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00536         meNpixZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, npixl, npixh); 
00537         sprintf(chisto, "meNxpixZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00538         meNxpixZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);      
00539         sprintf(chisto, "meNypixZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00540         meNypixZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);      
00541         sprintf(chisto, "meChargeZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00542         meChargeZpPanel2DiskPlaq[i][j] = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);   
00543         sprintf(chisto, "meResXvsAlphaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00544         meResXvsAlphaZpPanel2DiskPlaq[i][j] 
00545           = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resxh, "");
00546         sprintf(chisto, "meResYvsAlphaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00547         meResYvsAlphaZpPanel2DiskPlaq[i][j] 
00548           = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resyh, "");
00549         sprintf(chisto, "meResXvsBetaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00550         meResXvsBetaZpPanel2DiskPlaq[i][j] 
00551           = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resxh, "");
00552         sprintf(chisto, "meResYvsBetaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00553         meResYvsBetaZpPanel2DiskPlaq[i][j] 
00554           = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resyh, "");
00555     
00556         sprintf(chisto, "mePullXvsAlphaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00557         mePullXvsAlphaZpPanel2DiskPlaq[i][j] 
00558           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl,pullxh, "");
00559         sprintf(chisto, "mePullYvsAlphaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00560         mePullYvsAlphaZpPanel2DiskPlaq[i][j] 
00561           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl,pullyh, "");
00562         sprintf(chisto, "mePullXvsBetaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00563         mePullXvsBetaZpPanel2DiskPlaq[i][j] 
00564           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl,pullxh, "");
00565         sprintf(chisto, "mePullYvsBetaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00566         mePullYvsBetaZpPanel2DiskPlaq[i][j] 
00567           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl,pullyh, "");
00568         sprintf(chisto, "mePullXvsPhiZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00569         mePullXvsPhiZpPanel2DiskPlaq[i][j] 
00570           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,pullxh, "");
00571         sprintf(chisto, "mePullYvsPhiZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00572         mePullYvsPhiZpPanel2DiskPlaq[i][j] 
00573           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,pullyh, "");
00574         sprintf(chisto, "mePullXvsEtaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00575         mePullXvsEtaZpPanel2DiskPlaq[i][j] 
00576           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl,pullxh, "");
00577         sprintf(chisto, "mePullYvsEtaZpPanel2DiskPlaq_%d_%d", i+1, j+1);
00578         mePullYvsEtaZpPanel2DiskPlaq[i][j] 
00579           = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl,pullyh, "");
00580       
00581       } // for (int j=0; j<4; j++) // loop over plaquettes
00582 
00583   dbe_->setCurrentFolder("Tracking/TrackingRecHits/Pixel/Histograms_all");
00584 
00585   Char_t chisto[100];
00586   sprintf(chisto, "mePosxBarrel");
00587   mePosxBarrel = dbe_->book1D(chisto, chisto, 100, xl, xh);
00588   sprintf(chisto, "mePosyBarrel"); 
00589   mePosyBarrel = dbe_->book1D(chisto, chisto, 100, yl, yh);
00590   sprintf(chisto, "meErrxBarrel");
00591   meErrxBarrel = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00592   sprintf(chisto, "meErryBarrel");
00593   meErryBarrel = dbe_->book1D(chisto, chisto, 100, erryl, erryh);       
00594   sprintf(chisto, "meResxBarrel");
00595   meResxBarrel = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00596   sprintf(chisto, "meResyBarrel");
00597   meResyBarrel = dbe_->book1D(chisto, chisto, 100, resyl, resyh);       
00598   sprintf(chisto, "mePullxBarrel");
00599   mePullxBarrel = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00600   sprintf(chisto, "mePullyBarrel");
00601   mePullyBarrel = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);    
00602   sprintf(chisto, "meNpixBarrel");
00603   meNpixBarrel = dbe_->book1D(chisto, chisto, 100, npixl, npixh);
00604   sprintf(chisto, "meNxpixBarrel");
00605   meNxpixBarrel = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);
00606   sprintf(chisto, "meNypixBarrel");
00607   meNypixBarrel = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);
00608   sprintf(chisto, "meChargeBarrel");
00609   meChargeBarrel = dbe_->book1D(chisto, chisto, 100, barrel_chargel, barrel_chargeh);
00610   sprintf(chisto, "meResXvsAlphaBarrel");
00611   meResXvsAlphaBarrel = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
00612   sprintf(chisto, "meResYvsAlphaBarrel");
00613   meResYvsAlphaBarrel = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");       
00614   sprintf(chisto, "meResXvsBetaBarrel");
00615   meResXvsBetaBarrel = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
00616   sprintf(chisto, "meResYvsBetaBarrel");
00617   meResYvsBetaBarrel = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");  
00618  
00619   sprintf(chisto, "mePullXvsAlphaBarrel");
00620   mePullXvsAlphaBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
00621   sprintf(chisto, "mePullYvsAlphaBarrel");
00622   mePullYvsAlphaBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");        
00623   sprintf(chisto, "mePullXvsBetaBarrel");
00624   mePullXvsBetaBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
00625   sprintf(chisto, "mePullYvsBetaBarrel");
00626   mePullYvsBetaBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");   
00627   sprintf(chisto, "mePullXvsPhiBarrel");
00628   mePullXvsPhiBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
00629   sprintf(chisto, "mePullYvsPhiBarrel");
00630   mePullYvsPhiBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");      
00631   sprintf(chisto, "mePullXvsEtaBarrel");
00632   mePullXvsEtaBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
00633   sprintf(chisto, "mePullYvsEtaBarrel");
00634   mePullYvsEtaBarrel = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");      
00635 
00636   sprintf(chisto, "mePosxBarrelHalfModule");
00637   mePosxBarrelHalfModule = dbe_->book1D(chisto, chisto, 100, xl, xh);
00638   sprintf(chisto, "mePosxBarrelFullModule");
00639   mePosxBarrelFullModule = dbe_->book1D(chisto, chisto, 100, xl, xh);
00640   sprintf(chisto, "mePosxBarrelFlippedLadders");
00641   mePosxBarrelFlippedLadders = dbe_->book1D(chisto, chisto, 100, xl, xh);
00642   sprintf(chisto, "mePosxBarrelNonFlippedLadders");
00643   mePosxBarrelNonFlippedLadders = dbe_->book1D(chisto, chisto, 100, xl, xh);
00644   sprintf(chisto, "mePosyBarrelHalfModule");
00645   mePosyBarrelHalfModule = dbe_->book1D(chisto, chisto, 100, yl, yh);
00646   sprintf(chisto, "mePosyBarrelFullModule");
00647   mePosyBarrelFullModule = dbe_->book1D(chisto, chisto, 100, yl, yh);
00648   sprintf(chisto, "mePosyBarrelFlippedLadders");
00649   mePosyBarrelFlippedLadders = dbe_->book1D(chisto, chisto, 100, yl, yh);
00650   sprintf(chisto, "mePosyBarrelNonFlippedLadders");
00651   mePosyBarrelNonFlippedLadders = dbe_->book1D(chisto, chisto, 100, yl, yh);
00652   
00653   sprintf(chisto, "meResXvsAlphaBarrelFlippedLadders");
00654   meResXvsAlphaBarrelFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
00655   sprintf(chisto, "meResYvsAlphaBarrelFlippedLadders");
00656   meResYvsAlphaBarrelFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, ""); 
00657   sprintf(chisto, "meResXvsBetaBarrelFlippedLadders");
00658   meResXvsBetaBarrelFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
00659   sprintf(chisto, "meResYvsBetaBarrelFlippedLadders");
00660   meResYvsBetaBarrelFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, "");    
00661 
00662   sprintf(chisto, "mePullXvsAlphaBarrelFlippedLadders");
00663   mePullXvsAlphaBarrelFlippedLadders 
00664     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
00665   sprintf(chisto, "mePullYvsAlphaBarrelFlippedLadders");
00666   mePullYvsAlphaBarrelFlippedLadders 
00667     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");   
00668   sprintf(chisto, "mePullXvsBetaBarrelFlippedLadders");
00669   mePullXvsBetaBarrelFlippedLadders 
00670     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
00671   sprintf(chisto, "mePullYvsBetaBarrelFlippedLadders");
00672   mePullYvsBetaBarrelFlippedLadders 
00673     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");     
00674   sprintf(chisto, "mePullXvsPhiBarrelFlippedLadders");
00675   mePullXvsPhiBarrelFlippedLadders 
00676     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
00677   sprintf(chisto, "mePullYvsPhiBarrelFlippedLadders");
00678   mePullYvsPhiBarrelFlippedLadders 
00679     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");       
00680   sprintf(chisto, "mePullXvsEtaBarrelFlippedLadders");
00681   mePullXvsEtaBarrelFlippedLadders 
00682     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
00683   sprintf(chisto, "mePullYvsEtaBarrelFlippedLadders");
00684   mePullYvsEtaBarrelFlippedLadders 
00685     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");       
00686 
00687   
00688   sprintf(chisto, "meWPullXvsAlphaBarrelFlippedLadders");
00689   meWPullXvsAlphaBarrelFlippedLadders 
00690     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
00691   sprintf(chisto, "meWPullYvsAlphaBarrelFlippedLadders");
00692   meWPullYvsAlphaBarrelFlippedLadders 
00693     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");   
00694   sprintf(chisto, "meWPullXvsBetaBarrelFlippedLadders");
00695   meWPullXvsBetaBarrelFlippedLadders 
00696     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
00697   sprintf(chisto, "meWPullYvsBetaBarrelFlippedLadders");
00698   meWPullYvsBetaBarrelFlippedLadders 
00699     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");     
00700  
00701   sprintf(chisto, "meResXvsAlphaBarrelNonFlippedLadders");
00702   meResXvsAlphaBarrelNonFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resxh, "");
00703   sprintf(chisto, "meResYvsAlphaBarrelNonFlippedLadders");
00704   meResYvsAlphaBarrelNonFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_alphal, barrel_alphah, 100, 0.0, resyh, "");      
00705   sprintf(chisto, "meResXvsBetaBarrelNonFlippedLadders");
00706   meResXvsBetaBarrelNonFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resxh, "");
00707   sprintf(chisto, "meResYvsBetaBarrelNonFlippedLadders");
00708   meResYvsBetaBarrelNonFlippedLadders = dbe_->bookProfile(chisto, chisto, 20, barrel_betal, barrel_betah, 100, 0.0, resyh, ""); 
00709 
00710   sprintf(chisto, "mePullXvsAlphaBarrelNonFlippedLadders");
00711   mePullXvsAlphaBarrelNonFlippedLadders 
00712     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
00713   sprintf(chisto, "mePullYvsAlphaBarrelNonFlippedLadders");
00714   mePullYvsAlphaBarrelNonFlippedLadders 
00715     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");   
00716   sprintf(chisto, "mePullXvsBetaBarrelNonFlippedLadders");
00717   mePullXvsBetaBarrelNonFlippedLadders 
00718     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
00719   sprintf(chisto, "mePullYvsBetaBarrelNonFlippedLadders");
00720   mePullYvsBetaBarrelNonFlippedLadders 
00721     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");     
00722   sprintf(chisto, "mePullXvsPhiBarrelNonFlippedLadders");
00723   mePullXvsPhiBarrelNonFlippedLadders 
00724     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullxl, pullxh, "");
00725   sprintf(chisto, "mePullYvsPhiBarrelNonFlippedLadders");
00726   mePullYvsPhiBarrelNonFlippedLadders 
00727     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_phil, pull_barrel_phih, 100, pullyl, pullyh, "");       
00728   sprintf(chisto, "mePullXvsEtaBarrelNonFlippedLadders");
00729   mePullXvsEtaBarrelNonFlippedLadders 
00730     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullxl, pullxh, "");
00731   sprintf(chisto, "mePullYvsEtaBarrelNonFlippedLadders");
00732   mePullYvsEtaBarrelNonFlippedLadders 
00733     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_etal, pull_barrel_etah, 100, pullyl, pullyh, "");       
00734 
00735 
00736   sprintf(chisto, "meWPullXvsAlphaBarrelNonFlippedLadders");
00737   meWPullXvsAlphaBarrelNonFlippedLadders 
00738     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullxl, pullxh, "");
00739   sprintf(chisto, "meWPullYvsAlphaBarrelNonFlippedLadders");
00740   meWPullYvsAlphaBarrelNonFlippedLadders 
00741     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_alphal, pull_barrel_alphah, 100, pullyl, pullyh, "");   
00742   sprintf(chisto, "meWPullXvsBetaBarrelNonFlippedLadders");
00743   meWPullXvsBetaBarrelNonFlippedLadders 
00744     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullxl, pullxh, "");
00745   sprintf(chisto, "meWPullYvsBetaBarrelNonFlippedLadders");
00746   meWPullYvsBetaBarrelNonFlippedLadders 
00747     = dbe_->bookProfile(chisto, chisto, 20, pull_barrel_betal, pull_barrel_betah, 100, pullyl, pullyh, "");     
00748 
00749 
00750   sprintf(chisto, "mePosxZmPanel1");
00751   mePosxZmPanel1 = dbe_->book1D(chisto, chisto, 100, xl, xh);
00752   sprintf(chisto, "mePosyZmPanel1");
00753   mePosyZmPanel1 = dbe_->book1D(chisto, chisto, 100, yl, yh);
00754   sprintf(chisto, "meErrxZmPanel1");
00755   meErrxZmPanel1 = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00756   sprintf(chisto, "meErryZmPanel1");
00757   meErryZmPanel1 = dbe_->book1D(chisto, chisto, 100, erryl, erryh);     
00758   sprintf(chisto, "meResxZmPanel1");
00759   meResxZmPanel1 = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00760   sprintf(chisto, "meResyZmPanel1");
00761   meResyZmPanel1 = dbe_->book1D(chisto, chisto, 100, resyl, resyh);     
00762   sprintf(chisto, "mePullxZmPanel1");
00763   mePullxZmPanel1 = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00764   sprintf(chisto, "mePullyZmPanel1");
00765   mePullyZmPanel1 = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);  
00766   sprintf(chisto, "meNpixZmPanel1");
00767   meNpixZmPanel1 = dbe_->book1D(chisto, chisto, 100, npixl, npixh);     
00768   sprintf(chisto, "meNxpixZmPanel1");
00769   meNxpixZmPanel1 = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);  
00770   sprintf(chisto, "meNypixZmPanel1");
00771   meNypixZmPanel1 = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);  
00772   sprintf(chisto, "meChargeZmPanel1");
00773   meChargeZmPanel1 = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);       
00774   sprintf(chisto, "meResXvsAlphaZmPanel1");
00775   meResXvsAlphaZmPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resxh, "");
00776   sprintf(chisto, "meResYvsAlphaZmPanel1");
00777   meResYvsAlphaZmPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resyh, "");    
00778   sprintf(chisto, "meResXvsBetaZmPanel1");
00779   meResXvsBetaZmPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resxh, "");
00780   sprintf(chisto, "meResYvsBetaZmPanel1");
00781   meResYvsBetaZmPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resyh, "");     
00782 
00783   sprintf(chisto, "mePullXvsAlphaZmPanel1");
00784   mePullXvsAlphaZmPanel1 
00785     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl,  pullxh, "");
00786   sprintf(chisto, "mePullYvsAlphaZmPanel1");
00787   mePullYvsAlphaZmPanel1 
00788     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl,  pullyh, "");  
00789   sprintf(chisto, "mePullXvsBetaZmPanel1");
00790   mePullXvsBetaZmPanel1 
00791     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl,  pullxh, "");
00792   sprintf(chisto, "mePullYvsBetaZmPanel1");
00793   mePullYvsBetaZmPanel1 
00794     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl,  pullyh, "");  
00795   sprintf(chisto, "mePullXvsPhiZmPanel1");
00796   mePullXvsPhiZmPanel1 
00797     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,  pullxh, "");
00798   sprintf(chisto, "mePullYvsPhiZmPanel1");
00799   mePullYvsPhiZmPanel1 
00800     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,  pullyh, "");    
00801   sprintf(chisto, "mePullXvsEtaZmPanel1");
00802   mePullXvsEtaZmPanel1 
00803     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl,  pullxh, "");
00804   sprintf(chisto, "mePullYvsEtaZmPanel1");
00805   mePullYvsEtaZmPanel1 
00806     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl,  pullyh, "");
00807 
00808   sprintf(chisto, "meWPullXvsAlphaZmPanel1");
00809   meWPullXvsAlphaZmPanel1 
00810     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl,  pullxh, "");
00811   sprintf(chisto, "meWPullYvsAlphaZmPanel1");
00812   meWPullYvsAlphaZmPanel1 
00813     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl,  pullyh, "");  
00814   sprintf(chisto, "meWPullXvsBetaZmPanel1");
00815   meWPullXvsBetaZmPanel1 
00816     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl,  pullxh, "");
00817   sprintf(chisto, "meWPullYvsBetaZmPanel1");
00818   meWPullYvsBetaZmPanel1 
00819     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl,  pullyh, "");  
00820 
00821   sprintf(chisto, "mePosxZpPanel1");
00822   mePosxZpPanel1 = dbe_->book1D(chisto, chisto, 100, xl, xh);
00823   sprintf(chisto, "mePosyZpPanel1");
00824   mePosyZpPanel1 = dbe_->book1D(chisto, chisto, 100, yl, yh);
00825   sprintf(chisto, "meErrxZpPanel1");
00826   meErrxZpPanel1 = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00827   sprintf(chisto, "meErryZpPanel1");
00828   meErryZpPanel1 = dbe_->book1D(chisto, chisto, 100, erryl, erryh);     
00829   sprintf(chisto, "meResxZpPanel1");
00830   meResxZpPanel1 = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00831   sprintf(chisto, "meResyZpPanel1");
00832   meResyZpPanel1 = dbe_->book1D(chisto, chisto, 100, resyl, resyh);     
00833   sprintf(chisto, "mePullxZpPanel1");
00834   mePullxZpPanel1 = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00835   sprintf(chisto, "mePullyZpPanel1");
00836   mePullyZpPanel1 = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);  
00837   sprintf(chisto, "meNpixZpPanel1");
00838   meNpixZpPanel1 = dbe_->book1D(chisto, chisto, 100, npixl, npixh);     
00839   sprintf(chisto, "meNxpixZpPanel1");
00840   meNxpixZpPanel1 = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);  
00841   sprintf(chisto, "meNypixZpPanel1");
00842   meNypixZpPanel1 = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);  
00843   sprintf(chisto, "meChargeZpPanel1");
00844   meChargeZpPanel1 = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);       
00845   sprintf(chisto, "meResXvsAlphaZpPanel1");
00846   meResXvsAlphaZpPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resxh, "");
00847   sprintf(chisto, "meResYvsAlphaZpPanel1");
00848   meResYvsAlphaZpPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_p1_alphal, forward_p1_alphah, 100, 0.0,  resyh, "");    
00849   sprintf(chisto, "meResXvsBetaZpPanel1");
00850   meResXvsBetaZpPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resxh, "");
00851   sprintf(chisto, "meResYvsBetaZpPanel1");
00852   meResYvsBetaZpPanel1 = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resyh, "");     
00853  
00854   sprintf(chisto, "mePullXvsAlphaZpPanel1");
00855   mePullXvsAlphaZpPanel1 
00856     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl,  pullxh, "");
00857   sprintf(chisto, "mePullYvsAlphaZpPanel1");
00858   mePullYvsAlphaZpPanel1 
00859     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl,  pullyh, "");  
00860   sprintf(chisto, "mePullXvsBetaZpPanel1");
00861   mePullXvsBetaZpPanel1 
00862     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl,  pullxh, "");
00863   sprintf(chisto, "mePullYvsBetaZpPanel1");
00864   mePullYvsBetaZpPanel1 
00865     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl,  pullyh, "");  
00866   sprintf(chisto, "mePullXvsPhiZpPanel1");
00867   mePullXvsPhiZpPanel1 
00868     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,  pullxh, "");
00869   sprintf(chisto, "mePullYvsPhiZpPanel1");
00870   mePullYvsPhiZpPanel1 
00871     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,  pullyh, "");    
00872   sprintf(chisto, "mePullXvsEtaZpPanel1");
00873   mePullXvsEtaZpPanel1 
00874     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl,  pullxh, "");
00875   sprintf(chisto, "mePullYvsEtaZpPanel1");
00876   mePullYvsEtaZpPanel1 
00877     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl,  pullyh, "");
00878  
00879   sprintf(chisto, "meWPullXvsAlphaZpPanel1");
00880   meWPullXvsAlphaZpPanel1 
00881     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullxl,  pullxh, "");
00882   sprintf(chisto, "meWPullYvsAlphaZpPanel1");
00883   meWPullYvsAlphaZpPanel1 
00884     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p1_alphal, pull_forward_p1_alphah, 100, pullyl,  pullyh, "");  
00885   sprintf(chisto, "meWPullXvsBetaZpPanel1");
00886   meWPullXvsBetaZpPanel1 
00887     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl,  pullxh, "");
00888   sprintf(chisto, "meWPullYvsBetaZpPanel1");
00889   meWPullYvsBetaZpPanel1 
00890     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl,  pullyh, "");  
00891 
00892   sprintf(chisto, "mePosxZmPanel2");
00893   mePosxZmPanel2 = dbe_->book1D(chisto, chisto, 100, xl, xh);
00894   sprintf(chisto, "mePosyZmPanel2");
00895   mePosyZmPanel2 = dbe_->book1D(chisto, chisto, 100, yl, yh);
00896   sprintf(chisto, "meErrxZmPanel2");
00897   meErrxZmPanel2 = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00898   sprintf(chisto, "meErryZmPanel2");
00899   meErryZmPanel2 = dbe_->book1D(chisto, chisto, 100, erryl, erryh);     
00900   sprintf(chisto, "meResxZmPanel2");
00901   meResxZmPanel2 = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00902   sprintf(chisto, "meResyZmPanel2");
00903   meResyZmPanel2 = dbe_->book1D(chisto, chisto, 100, resyl, resyh);     
00904   sprintf(chisto, "mePullxZmPanel2");
00905   mePullxZmPanel2 = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00906   sprintf(chisto, "mePullyZmPanel2");
00907   mePullyZmPanel2 = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);  
00908   sprintf(chisto, "meNpixZmPanel2");
00909   meNpixZmPanel2 = dbe_->book1D(chisto, chisto, 100, npixl, npixh);     
00910   sprintf(chisto, "meNxpixZmPanel2");
00911   meNxpixZmPanel2 = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);  
00912   sprintf(chisto, "meNypixZmPanel2");
00913   meNypixZmPanel2 = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);  
00914   sprintf(chisto, "meChargeZmPanel2");
00915   meChargeZmPanel2 = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);       
00916   sprintf(chisto, "meResXvsAlphaZmPanel2");
00917   meResXvsAlphaZmPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resxh, "");
00918   sprintf(chisto, "meResYvsAlphaZmPanel2");
00919   meResYvsAlphaZmPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resyh, "");    
00920   sprintf(chisto, "meResXvsBetaZmPanel2");
00921   meResXvsBetaZmPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resxh, "");
00922   sprintf(chisto, "meResYvsBetaZmPanel2");
00923   meResYvsBetaZmPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_neg_betal, forward_neg_betah, 100, 0.0,  resyh, "");     
00924  
00925   sprintf(chisto, "mePullXvsAlphaZmPanel2");
00926   mePullXvsAlphaZmPanel2 
00927     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl,  pullxh, "");
00928   sprintf(chisto, "mePullYvsAlphaZmPanel2");
00929   mePullYvsAlphaZmPanel2 
00930     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl,  pullyh, "");  
00931   sprintf(chisto, "mePullXvsBetaZmPanel2");
00932   mePullXvsBetaZmPanel2 
00933     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl,  pullxh, "");
00934   sprintf(chisto, "mePullYvsBetaZmPanel2");
00935   mePullYvsBetaZmPanel2 
00936     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl,  pullyh, "");  
00937   sprintf(chisto, "mePullXvsPhiZmPanel2");
00938   mePullXvsPhiZmPanel2 
00939     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,  pullxh, "");
00940   sprintf(chisto, "mePullYvsPhiZmPanel2");
00941   mePullYvsPhiZmPanel2 
00942     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,  pullyh, "");    
00943   sprintf(chisto, "mePullXvsEtaZmPanel2");
00944   mePullXvsEtaZmPanel2 
00945     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullxl,  pullxh, "");
00946   sprintf(chisto, "mePullYvsEtaZmPanel2");
00947   mePullYvsEtaZmPanel2 
00948     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_etal, pull_forward_neg_etah, 100, pullyl,  pullyh, "");
00949 
00950   sprintf(chisto, "meWPullXvsAlphaZmPanel2");
00951   meWPullXvsAlphaZmPanel2 
00952     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl,  pullxh, "");
00953   sprintf(chisto, "meWPullYvsAlphaZmPanel2");
00954   meWPullYvsAlphaZmPanel2 
00955     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl,  pullyh, "");  
00956   sprintf(chisto, "meWPullXvsBetaZmPanel2");
00957   meWPullXvsBetaZmPanel2 
00958     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullxl,  pullxh, "");
00959   sprintf(chisto, "meWPullYvsBetaZmPanel2");
00960   meWPullYvsBetaZmPanel2 
00961     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_neg_betal, pull_forward_neg_betah, 100, pullyl,  pullyh, "");  
00962 
00963 
00964   sprintf(chisto, "mePosxZpPanel2");
00965   mePosxZpPanel2 = dbe_->book1D(chisto, chisto, 100, xl, xh);
00966   sprintf(chisto, "mePosyZpPanel2");
00967   mePosyZpPanel2 = dbe_->book1D(chisto, chisto, 100, yl, yh);
00968   sprintf(chisto, "meErrxZpPanel2");
00969   meErrxZpPanel2 = dbe_->book1D(chisto, chisto, 100, errxl, errxh);
00970   sprintf(chisto, "meErryZpPanel2");
00971   meErryZpPanel2 = dbe_->book1D(chisto, chisto, 100, erryl, erryh);     
00972   sprintf(chisto, "meResxZpPanel2");
00973   meResxZpPanel2 = dbe_->book1D(chisto, chisto, 100, resxl, resxh);
00974   sprintf(chisto, "meResyZpPanel2");
00975   meResyZpPanel2 = dbe_->book1D(chisto, chisto, 100, resyl, resyh);     
00976   sprintf(chisto, "mePullxZpPanel2");
00977   mePullxZpPanel2 = dbe_->book1D(chisto, chisto, 100, pullxl, pullxh);
00978   sprintf(chisto, "mePullyZpPanel2");
00979   mePullyZpPanel2 = dbe_->book1D(chisto, chisto, 100, pullyl, pullyh);  
00980   sprintf(chisto, "meNpixZpPanel2");
00981   meNpixZpPanel2 = dbe_->book1D(chisto, chisto, 100, npixl, npixh);     
00982   sprintf(chisto, "meNxpixZpPanel2");
00983   meNxpixZpPanel2 = dbe_->book1D(chisto, chisto, 100, nxpixl, nxpixh);  
00984   sprintf(chisto, "meNypixZpPanel2");
00985   meNypixZpPanel2 = dbe_->book1D(chisto, chisto, 100, nypixl, nypixh);  
00986   sprintf(chisto, "meChargeZpPanel2");
00987   meChargeZpPanel2 = dbe_->book1D(chisto, chisto, 100, forward_chargel, forward_chargeh);       
00988   sprintf(chisto, "meResXvsAlphaZpPanel2");
00989   meResXvsAlphaZpPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resxh, "");
00990   sprintf(chisto, "meResYvsAlphaZpPanel2");
00991   meResYvsAlphaZpPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_p2_alphal, forward_p2_alphah, 100, 0.0,  resyh, "");    
00992   sprintf(chisto, "meResXvsBetaZpPanel2");
00993   meResXvsBetaZpPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resxh, "");
00994   sprintf(chisto, "meResYvsBetaZpPanel2");
00995   meResYvsBetaZpPanel2 = dbe_->bookProfile(chisto, chisto, 20, forward_pos_betal, forward_pos_betah, 100, 0.0,  resyh, "");     
00996  
00997   sprintf(chisto, "mePullXvsAlphaZpPanel2");
00998   mePullXvsAlphaZpPanel2 
00999     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl,  pullxh, "");
01000   sprintf(chisto, "mePullYvsAlphaZpPanel2");
01001   mePullYvsAlphaZpPanel2 
01002     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl,  pullyh, "");  
01003   sprintf(chisto, "mePullXvsBetaZpPanel2");
01004   mePullXvsBetaZpPanel2 
01005     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl,  pullxh, "");
01006   sprintf(chisto, "mePullYvsBetaZpPanel2");
01007   mePullYvsBetaZpPanel2 
01008     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl,  pullyh, "");    
01009   sprintf(chisto, "mePullXvsPhiZpPanel2");
01010   mePullXvsPhiZpPanel2 
01011     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullxl,  pullxh, "");
01012   sprintf(chisto, "mePullYvsPhiZpPanel2");
01013   mePullYvsPhiZpPanel2 
01014     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_phil, pull_forward_phih, 100, pullyl,  pullyh, "");    
01015   sprintf(chisto, "mePullXvsEtaZpPanel2");
01016   mePullXvsEtaZpPanel2 
01017     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullxl,  pullxh, "");
01018   sprintf(chisto, "mePullYvsEtaZpPanel2");
01019   mePullYvsEtaZpPanel2 
01020     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_etal, pull_forward_pos_etah, 100, pullyl,  pullyh, "");
01021 
01022   sprintf(chisto, "meWPullXvsAlphaZpPanel2");
01023   meWPullXvsAlphaZpPanel2 
01024     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullxl,  pullxh, "");
01025   sprintf(chisto, "meWPullYvsAlphaZpPanel2");
01026   meWPullYvsAlphaZpPanel2 
01027     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_p2_alphal, pull_forward_p2_alphah, 100, pullyl,  pullyh, "");  
01028   sprintf(chisto, "meWPullXvsBetaZpPanel2");
01029   meWPullXvsBetaZpPanel2 
01030     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullxl,  pullxh, "");
01031   sprintf(chisto, "meWPullYvsBetaZpPanel2");
01032   meWPullYvsBetaZpPanel2 
01033     = dbe_->bookProfile(chisto, chisto, 20, pull_forward_pos_betal, pull_forward_pos_betah, 100, pullyl,  pullyh, "");
01034 
01035   // all hits (not only from tracks) 
01036   sprintf(chisto, "mePosxBarrel_all_hits");
01037   mePosxBarrel_all_hits = dbe_->book1D(chisto, chisto, 100, xl, xh);
01038   sprintf(chisto, "mePosyBarrel_all_hits"); 
01039   mePosyBarrel_all_hits = dbe_->book1D(chisto, chisto, 100, yl, yh);
01040 
01041   sprintf(chisto, "mePosxZmPanel1_all_hits");
01042   mePosxZmPanel1_all_hits = dbe_->book1D(chisto, chisto, 100, xl, xh);
01043   sprintf(chisto, "mePosyZmPanel1_all_hits");
01044   mePosyZmPanel1_all_hits = dbe_->book1D(chisto, chisto, 100, yl, yh);
01045   sprintf(chisto, "mePosxZmPanel2_all_hits");
01046   mePosxZmPanel2_all_hits = dbe_->book1D(chisto, chisto, 100, xl, xh);
01047   sprintf(chisto, "mePosyZmPanel2_all_hits");
01048   mePosyZmPanel2_all_hits = dbe_->book1D(chisto, chisto, 100, yl, yh);
01049 
01050   sprintf(chisto, "mePosxZpPanel1_all_hits");
01051   mePosxZpPanel1_all_hits = dbe_->book1D(chisto, chisto, 100, xl, xh);
01052   sprintf(chisto, "mePosyZpPanel1_all_hits");
01053   mePosyZpPanel1_all_hits = dbe_->book1D(chisto, chisto, 100, yl, yh);
01054   sprintf(chisto, "mePosxZpPanel2_all_hits");
01055   mePosxZpPanel2_all_hits = dbe_->book1D(chisto, chisto, 100, xl, xh);
01056   sprintf(chisto, "mePosyZpPanel2_all_hits");
01057   mePosyZpPanel2_all_hits = dbe_->book1D(chisto, chisto, 100, yl, yh);
01058 
01059   // control histograms
01060   meTracksPerEvent     = dbe_->book1D("meTracksPerEvent"    , "meTracksPerEvent"    , 200, 0.0, 200.0);
01061   mePixRecHitsPerTrack = dbe_->book1D("mePixRecHitsPerTrack", "mePixRecHitsPerTrack",  6, 0.0,  6.0);
01062 
01063 }
01064 
01065 // Virtual destructor needed.
01066 SiPixelTrackingRecHitsValid::~SiPixelTrackingRecHitsValid() 
01067 {  
01068   if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
01069 }  
01070 
01071 // Functions that gets called by framework every event
01072 void SiPixelTrackingRecHitsValid::analyze(const edm::Event& e, const edm::EventSetup& es)
01073 {
01074   run = e.id().run();
01075   evt = e.id().event();
01076 
01077   //  if ( evt%1000 == 0 ) 
01078     //cout << "evt = " << evt << endl;
01079   
01080   float math_pi = 3.14159265;
01081   float radtodeg = 180.0 / math_pi;
01082     
01083   DetId detId;
01084 
01085   LocalPoint position;
01086   LocalError error;
01087   float mindist = 999999.9;
01088 
01089   std::vector<PSimHit> matched;
01090   TrackerHitAssociator associate(e,conf_);
01091 
01092   edm::ESHandle<TrackerGeometry> pDD;
01093   es.get<TrackerDigiGeometryRecord> ().get (pDD);
01094   const TrackerGeometry* tracker = &(* pDD);
01095 
01096   if ( !MTCCtrack_ )
01097     {
01098       // --------------------------------------- all hits -----------------------------------------------------------
01099       //--- Fetch Pixel RecHits
01100       edm::Handle<SiPixelRecHitCollection> recHitColl;
01101       e.getByLabel( "siPixelRecHits", recHitColl);
01102       
01103       //cout <<" ----- Found " 
01104       //   << const_cast<SiPixelRecHitCollection*>(recHitColl.product())->size()
01105       //   << " Pixel RecHits" << std::endl;
01106   
01107       //-----Iterate over detunits
01108       for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) 
01109         {
01110           DetId detId = ((*it)->geographicalId());
01111          
01112           unsigned int subid = detId.subdetId();
01113           if ( !((subid==1) || (subid==2)) ) 
01114             continue; // end subid if
01115 
01116           SiPixelRecHitCollection::const_iterator match = recHitColl->find(detId);
01117           if (match == recHitColl->end()) continue;
01118 
01119           SiPixelRecHitCollection::DetSet pixelrechitRange = *match;
01120           SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
01121           SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
01122           SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
01123           std::vector<PSimHit> matched;
01124           
01125           //----Loop over rechits for this detId
01126           for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) 
01127             {
01128               LocalPoint lp = pixeliter->localPosition();
01129               float rechitx = lp.x();
01130               float rechity = lp.y();
01131              
01132               detId = (*it)->geographicalId();
01133               subdetId = (int)detId.subdetId();
01134               if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel ) 
01135                 {
01136                   mePosxBarrel_all_hits->Fill( rechitx );
01137                   mePosyBarrel_all_hits->Fill( rechity );
01138                 }
01139               else if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap )
01140                 {
01141                   PXFDetId fdetid(detId);
01142                   side  = fdetid.side();
01143                   disk  = fdetid.disk();
01144                   blade = fdetid.blade();
01145                   panel = fdetid.panel();
01146                   plaq  = fdetid.module(); // also known as plaquette
01147                   
01148                   if ( side==1 ) 
01149                     {
01150                       if ( panel==1 )
01151                         {
01152                           mePosxZmPanel1_all_hits->Fill( rechitx );
01153                           mePosyZmPanel1_all_hits->Fill( rechity );
01154                         }
01155                       else if ( panel==2 )
01156                         {
01157                           mePosxZmPanel2_all_hits->Fill( rechitx );
01158                           mePosyZmPanel2_all_hits->Fill( rechity );
01159                         }
01160                       else LogWarning("SiPixelTrackingRecHitsValid") << "..............................................Wrong panel number !"; 
01161                     } // if ( side==1 ) 
01162                   else if ( side==2 )
01163                     {
01164                       if ( panel==1 )
01165                         {
01166                           mePosxZpPanel1_all_hits->Fill( rechitx );
01167                           mePosyZpPanel1_all_hits->Fill( rechity );
01168                         }
01169                        else if ( panel==2 )
01170                          {
01171                            mePosxZpPanel2_all_hits->Fill( rechitx );
01172                            mePosyZpPanel2_all_hits->Fill( rechity );
01173                          }
01174                        else  LogWarning("SiPixelTrackingRecHitsValid")<< "..............................................Wrong panel number !";
01175                     } //else if ( side==2 )
01176                   else LogWarning("SiPixelTrackingRecHitsValid") << ".......................................................Wrong side !" ;
01177                   
01178                 } // else if ( detId.subdetId()==PixelSubdetector::PixelEndcap )
01179               else LogWarning("SiPixelTrackingRecHitsValid") << "Pixel rechit collection but we are not in the pixel detector" << (int)detId.subdetId() ;
01180               
01181             }
01182         }
01183       // ------------------------------------------------ all hits ---------------------------------------------------------------
01184        
01185       // Get tracks
01186       edm::Handle<reco::TrackCollection> trackCollection;
01187       e.getByLabel(src_, trackCollection);
01188       const reco::TrackCollection *tracks = trackCollection.product();
01189       reco::TrackCollection::const_iterator tciter;
01190 
01191       int n_tracks = (int)tracks->size(); // number of tracks in this event
01192       meTracksPerEvent->Fill( n_tracks );
01193 
01194       if ( tracks->size() > 0 )
01195         {
01196           // Loop on tracks
01197           for ( tciter=tracks->begin(); tciter!=tracks->end(); tciter++)
01198             {
01199               phi = tciter->momentum().phi() / math_pi*180.0;
01200               eta = tciter->momentum().eta();
01201               
01202               int n_hits = 0;
01203               // First loop on hits: find matched hits
01204               for ( trackingRecHit_iterator it = tciter->recHitsBegin(); it != tciter->recHitsEnd(); it++) 
01205                 {
01206                   const TrackingRecHit &thit = **it;
01207                   // Is it a matched hit?
01208                   const SiPixelRecHit* matchedhit = dynamic_cast<const SiPixelRecHit*>(&thit);
01209                   
01210                   if ( matchedhit ) 
01211                     {
01212                       ++n_hits;
01213                       
01214                       layer  = -9999; 
01215                       ladder = -9999; 
01216                       mod    = -9999; 
01217                       side   = -9999;  
01218                       disk   = -9999;  
01219                       blade  = -9999; 
01220                       panel  = -9999; 
01221                       plaq   = -9999; 
01222 
01223                       rechitx = -9999.9;
01224                       rechity = -9999.9;
01225                       rechitz = -9999.9;
01226                       rechiterrx = -9999.9;
01227                       rechiterry = -9999.9;                   
01228                       rechitresx = -9999.9;
01229                       rechitresy = -9999.9;
01230                       rechitpullx = -9999.9;
01231                       rechitpully = -9999.9;
01232                       
01233                       npix = -9999;
01234                       nxpix = -9999;
01235                       nypix = -9999;
01236                       charge = -9999.9;
01237                       
01238                       alpha = -9999.9;
01239                       beta  = -9999.9;
01240 
01241                       half = -9999;
01242                       flipped = -9999;
01243                  
01244                       nsimhit = -9999;
01245                          
01246                       simhitx = -9999.9;
01247                       simhity = -9999.9;
01248 
01249                       position = (*it)->localPosition();
01250                       error = (*it)->localPositionError();
01251 
01252                       rechitx = position.x();
01253                       rechity = position.y();
01254                       rechitz = position.z();
01255                       rechiterrx = sqrt(error.xx());
01256                       rechiterry = sqrt(error.yy());
01257 
01258                       npix = (*matchedhit).cluster()->size();
01259                       nxpix = (*matchedhit).cluster()->sizeX();
01260                       nypix = (*matchedhit).cluster()->sizeY();
01261                       charge = (*matchedhit).cluster()->charge();
01262 
01263                       //Association of the rechit to the simhit
01264                       matched.clear();
01265                       matched = associate.associateHit(*matchedhit);
01266 
01267                       nsimhit = (int)matched.size();
01268 
01269                       if ( !matched.empty() ) 
01270                         {
01271                           mindist = 999999.9;
01272                           float distx, disty, dist;
01273                           bool found_hit_from_generated_particle = false;
01274                           
01275                           int n_assoc_muon = 0;
01276 
01277                           vector<PSimHit>::const_iterator closestit = matched.begin();
01278                           for (vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++)
01279                             {
01280                               if ( checkType_ )
01281                                 {
01282                                   int pid = (*m).particleType();
01283                                   if ( abs(pid) != genType_ )
01284                                     continue;
01285                                   
01286                                 }
01287                               
01288                               float simhitx = 0.5 * ( (*m).entryPoint().x() + (*m).exitPoint().x() );
01289                               float simhity = 0.5 * ( (*m).entryPoint().y() + (*m).exitPoint().y() );
01290                               
01291                               distx = fabs(rechitx - simhitx);
01292                               disty = fabs(rechity - simhity);
01293                               dist = sqrt( distx*distx + disty*disty );
01294         
01295                               if ( dist < mindist )
01296                                 {
01297                                   n_assoc_muon++;
01298 
01299                                   mindist = dist;
01300                                   closestit = m;
01301                                   found_hit_from_generated_particle = true;
01302                                 }
01303                             } // for (vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++)
01304                           
01305                           // This recHit does not have any simHit with the same particleType as the particles generated
01306                           // Ignore it as most probably come from delta rays.
01307                           if ( checkType_ && !found_hit_from_generated_particle )
01308                             continue; 
01309                           
01310                           if ( n_assoc_muon > 1 )
01311                             {
01312                               LogWarning("SiPixelTrackingRecHitsValid") << " ----- This is not good: n_assoc_muon = " << n_assoc_muon ;
01313                               LogWarning("SiPixelTrackingRecHitsValid") << "evt = " << evt ;
01314                             }
01315 
01316                           pidhit = (*closestit).particleType();
01317 
01318                           simhitx = 0.5*( (*closestit).entryPoint().x() + (*closestit).exitPoint().x() );
01319                           simhity = 0.5*( (*closestit).entryPoint().y() + (*closestit).exitPoint().y() );
01320                           
01321                           rechitresx = rechitx - simhitx;
01322                           rechitresy = rechity - simhity;
01323                           rechitpullx = ( rechitx - simhitx ) / sqrt(error.xx());
01324                           rechitpully = ( rechity - simhity ) / sqrt(error.yy());
01325 
01326                           float simhitpx = (*closestit).momentumAtEntry().x();
01327                           float simhitpy = (*closestit).momentumAtEntry().y();
01328                           float simhitpz = (*closestit).momentumAtEntry().z();
01329                                                   
01330                           //beta  = atan2(simhitpz, simhitpy) * radtodeg;
01331                           //alpha = atan2(simhitpz, simhitpx) * radtodeg;
01332                           
01333                           beta  = fabs(atan2(simhitpz, simhitpy)) * radtodeg;
01334                           alpha = fabs(atan2(simhitpz, simhitpx)) * radtodeg;
01335                 
01336                           detId = (*it)->geographicalId();
01337 
01338                           subdetId = (int)detId.subdetId();
01339 
01340                           if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel ) 
01341                             {
01342                               mePosxBarrel->Fill( rechitx );
01343                               mePosyBarrel->Fill( rechity );
01344                               meErrxBarrel->Fill( rechiterrx );                       
01345                               meErryBarrel->Fill( rechiterry );
01346                               meResxBarrel->Fill( rechitresx );
01347                               meResyBarrel->Fill( rechitresy );
01348                               mePullxBarrel->Fill( rechitpullx );
01349                               mePullyBarrel->Fill( rechitpully );
01350                               meNpixBarrel->Fill( npix );
01351                               meNxpixBarrel->Fill( nxpix );
01352                               meNypixBarrel->Fill( nypix );
01353                               meChargeBarrel->Fill( charge );
01354                               meResXvsAlphaBarrel->Fill( alpha, fabs(rechitresx) );
01355                               meResYvsAlphaBarrel->Fill( alpha, fabs(rechitresy) );
01356                               meResXvsBetaBarrel->Fill( beta, fabs(rechitresx) );
01357                               meResYvsBetaBarrel->Fill( beta, fabs(rechitresy) );
01358                               mePullXvsAlphaBarrel->Fill( alpha, rechitpullx );
01359                               mePullYvsAlphaBarrel->Fill( alpha, rechitpully );
01360                               mePullXvsBetaBarrel->Fill( beta, rechitpullx );
01361                               mePullYvsBetaBarrel->Fill( beta, rechitpully );
01362                               mePullXvsPhiBarrel->Fill( phi, rechitpullx );
01363                               mePullYvsPhiBarrel->Fill( phi, rechitpully );
01364                               mePullXvsEtaBarrel->Fill( eta, rechitpullx );
01365                               mePullYvsEtaBarrel->Fill( eta, rechitpully );
01366                               
01367                               const PixelGeomDetUnit * theGeomDet 
01368                                 = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(detId) );
01369                               //const PixelTopology * topol = (&(theGeomDet->specificTopology()));
01370                               
01371                               int tmp_nrows = theGeomDet->specificTopology().nrows();
01372                               
01373                               if ( tmp_nrows == 80 ) 
01374                                 {
01375                                   mePosxBarrelHalfModule->Fill( rechitx );
01376                                   mePosyBarrelHalfModule->Fill( rechity );
01377                                   half = 1;
01378                                 }
01379                               else if ( tmp_nrows == 160 ) 
01380                                 {
01381                                   mePosxBarrelFullModule->Fill( rechitx );
01382                                   mePosyBarrelFullModule->Fill( rechity );
01383                                   half = 0;
01384                                 }
01385                               else 
01386                                 LogWarning("SiPixelTrackingRecHitsValid") << "-------------------------------------------------- Wrong module size !!!";
01387 
01388                               float tmp1 = theGeomDet->surface().toGlobal(Local3DPoint(0.,0.,0.)).perp();
01389                               float tmp2 = theGeomDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp();
01390                               
01391                               if ( tmp2<tmp1 ) 
01392                                 { // flipped
01393                                   mePosxBarrelFlippedLadders->Fill( rechitx );
01394                                   mePosyBarrelFlippedLadders->Fill( rechity );
01395                                   flipped = 1;
01396                                 
01397                                   meResXvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitresx) );
01398                                   meResYvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitresy) );
01399                                   meResXvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitresx) );
01400                                   meResYvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitresy) );
01401                                   mePullXvsAlphaBarrelFlippedLadders->Fill( alpha, rechitpullx );
01402                                   mePullYvsAlphaBarrelFlippedLadders->Fill( alpha, rechitpully );
01403                                   mePullXvsBetaBarrelFlippedLadders->Fill( beta, rechitpullx );
01404                                   mePullYvsBetaBarrelFlippedLadders->Fill( beta, rechitpully );
01405                                   mePullXvsPhiBarrelFlippedLadders->Fill( phi, rechitpullx );
01406                                   mePullYvsPhiBarrelFlippedLadders->Fill( phi, rechitpully );
01407                                   mePullXvsEtaBarrelFlippedLadders->Fill( eta, rechitpullx );
01408                                   mePullYvsEtaBarrelFlippedLadders->Fill( eta, rechitpully );
01409                                 
01410                                   meWPullXvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitpullx) );
01411                                   meWPullYvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitpully) );
01412                                   meWPullXvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitpullx) );
01413                                   meWPullYvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitpully) );
01414                                 }
01415                               else 
01416                                 { // not flipped
01417                                   mePosxBarrelNonFlippedLadders->Fill( rechitx );
01418                                   mePosyBarrelNonFlippedLadders->Fill( rechity );
01419                                   flipped = 0;
01420                                 
01421                                   meResXvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitresx) );
01422                                   meResYvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitresy) );
01423                                   meResXvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitresx) );
01424                                   meResYvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitresy) );
01425                                   mePullXvsAlphaBarrelNonFlippedLadders->Fill( alpha, rechitpullx );
01426                                   mePullYvsAlphaBarrelNonFlippedLadders->Fill( alpha, rechitpully );
01427                                   mePullXvsBetaBarrelNonFlippedLadders->Fill( beta, rechitpullx );
01428                                   mePullYvsBetaBarrelNonFlippedLadders->Fill( beta, rechitpully );
01429                                   mePullXvsPhiBarrelNonFlippedLadders->Fill( phi, rechitpullx );
01430                                   mePullYvsPhiBarrelNonFlippedLadders->Fill( phi, rechitpully );
01431                                   mePullXvsEtaBarrelNonFlippedLadders->Fill( eta, rechitpullx );
01432                                   mePullYvsEtaBarrelNonFlippedLadders->Fill( eta, rechitpully );
01433 
01434                                   meWPullXvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitpullx) );
01435                                   meWPullYvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitpully) );
01436                                   meWPullXvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitpullx) );
01437                                   meWPullYvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitpully) );
01438                                 }
01439                                   
01440                               PXBDetId  bdetid(detId);
01441                               layer  = bdetid.layer();   // Layer: 1,2,3.
01442                               ladder = bdetid.ladder();  // Ladder: 1-20, 32, 44. 
01443                               mod   = bdetid.module();  // Mod: 1-8.
01444                               
01445                               mePosxBarrelLayerModule[layer-1][mod-1]->Fill( rechitx );
01446                               mePosyBarrelLayerModule[layer-1][mod-1]->Fill( rechity );
01447                               meErrxBarrelLayerModule[layer-1][mod-1]->Fill( rechiterrx );
01448                               meErryBarrelLayerModule[layer-1][mod-1]->Fill( rechiterry );
01449                               meResxBarrelLayerModule[layer-1][mod-1]->Fill( rechitresx );
01450                               meResyBarrelLayerModule[layer-1][mod-1]->Fill( rechitresy );
01451                               mePullxBarrelLayerModule[layer-1][mod-1]->Fill( rechitpullx );
01452                               mePullyBarrelLayerModule[layer-1][mod-1]->Fill( rechitpully );
01453                               meNpixBarrelLayerModule[layer-1][mod-1]->Fill( npix );
01454                               meNxpixBarrelLayerModule[layer-1][mod-1]->Fill( nxpix );
01455                               meNypixBarrelLayerModule[layer-1][mod-1]->Fill( nypix );
01456                               meChargeBarrelLayerModule[layer-1][mod-1]->Fill( charge );
01457                               meResXvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, fabs(rechitresx) );
01458                               meResYvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, fabs(rechitresy) );
01459                               meResXvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, fabs(rechitresx) );
01460                               meResYvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, fabs(rechitresy) );
01461                               mePullXvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, rechitpullx );
01462                               mePullYvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, rechitpully );
01463                               mePullXvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, rechitpullx );
01464                               mePullYvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, rechitpully );
01465                               mePullXvsPhiBarrelLayerModule[layer-1][mod-1]->Fill( phi, rechitpullx );
01466                               mePullYvsPhiBarrelLayerModule[layer-1][mod-1]->Fill( phi, rechitpully );
01467                               mePullXvsEtaBarrelLayerModule[layer-1][mod-1]->Fill( eta, rechitpullx );
01468                               mePullYvsEtaBarrelLayerModule[layer-1][mod-1]->Fill( eta, rechitpully );
01469                             
01470                               meResxBarrelLayer[layer-1]->Fill( rechitresx );
01471                               meResyBarrelLayer[layer-1]->Fill( rechitresy );
01472                               mePullxBarrelLayer[layer-1]->Fill( rechitpullx );
01473                               mePullyBarrelLayer[layer-1]->Fill( rechitpully );
01474 
01475                               if ( tmp2<tmp1 ) 
01476                                 { // flipped
01477                                   meResXvsAlphaBarrelFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresx) );
01478                                   meResYvsAlphaBarrelFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresy) );
01479                                   meResXvsBetaBarrelFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresx) );
01480                                   meResYvsBetaBarrelFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresy) );
01481                                 }
01482                               else
01483                                 { // not flipped
01484                                   meResXvsAlphaBarrelNonFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresx) );
01485                                   meResYvsAlphaBarrelNonFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresy) );
01486                                   meResXvsBetaBarrelNonFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresx) );
01487                                   meResYvsBetaBarrelNonFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresy) );
01488                                 }
01489                               
01490                             }
01491                           else if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap )
01492                             {
01493                               PXFDetId fdetid(detId);
01494                               side  = fdetid.side();
01495                               disk  = fdetid.disk();
01496                               blade = fdetid.blade();
01497                               panel = fdetid.panel();
01498                               plaq  = fdetid.module(); // also known as plaquette
01499 
01500                               if ( side==1 ) 
01501                                 {
01502                                   if ( panel==1 )
01503                                     {
01504                                       mePosxZmPanel1->Fill( rechitx );
01505                                       mePosyZmPanel1->Fill( rechity );
01506                                       meErrxZmPanel1->Fill( rechiterrx );
01507                                       meErryZmPanel1->Fill( rechiterry );
01508                                       meResxZmPanel1->Fill( rechitresx );
01509                                       meResyZmPanel1->Fill( rechitresy );
01510                                       mePullxZmPanel1->Fill( rechitpullx );
01511                                       mePullyZmPanel1->Fill( rechitpully );
01512                                       meNpixZmPanel1->Fill( npix );
01513                                       meNxpixZmPanel1->Fill( nxpix );
01514                                       meNypixZmPanel1->Fill( nypix );
01515                                       meChargeZmPanel1->Fill( charge );
01516                                       meResXvsAlphaZmPanel1->Fill( alpha, fabs(rechitresx) );
01517                                       meResYvsAlphaZmPanel1->Fill( alpha, fabs(rechitresy) );
01518                                       meResXvsBetaZmPanel1->Fill( beta, fabs(rechitresx) );
01519                                       meResYvsBetaZmPanel1->Fill( beta, fabs(rechitresy) );
01520                                       mePullXvsAlphaZmPanel1->Fill( alpha, rechitpullx );
01521                                       mePullYvsAlphaZmPanel1->Fill( alpha, rechitpully );
01522                                       mePullXvsBetaZmPanel1->Fill( beta, rechitpullx );
01523                                       mePullYvsBetaZmPanel1->Fill( beta, rechitpully );
01524                                       mePullXvsPhiZmPanel1->Fill( phi, rechitpullx );
01525                                       mePullYvsPhiZmPanel1->Fill( phi, rechitpully );
01526                                       mePullXvsEtaZmPanel1->Fill( eta, rechitpullx );
01527                                       mePullYvsEtaZmPanel1->Fill( eta, rechitpully );
01528                                       
01529                                       meWPullXvsAlphaZmPanel1->Fill( alpha, fabs(rechitpullx) );
01530                                       meWPullYvsAlphaZmPanel1->Fill( alpha, fabs(rechitpully) );
01531                                       meWPullXvsBetaZmPanel1->Fill( beta, fabs(rechitpullx) );
01532                                       meWPullYvsBetaZmPanel1->Fill( beta, fabs(rechitpully) );
01533       
01534                                       mePosxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01535                                       mePosyZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01536                                       meErrxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01537                                       meErryZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01538                                       meResxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01539                                       meResyZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01540                                       mePullxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01541                                       mePullyZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01542                                       meNpixZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( npix );
01543                                       meNxpixZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01544                                       meNypixZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01545                                       meChargeZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( charge );
01546                                       meResXvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01547                                       meResYvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01548                                       meResXvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01549                                       meResYvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01550                                       mePullXvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01551                                       mePullYvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01552                                       mePullXvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01553                                       mePullYvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01554                                       mePullXvsPhiZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01555                                       mePullYvsPhiZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01556                                       mePullXvsEtaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01557                                       mePullYvsEtaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01558                                       
01559                                     }
01560                                   else if ( panel==2 )
01561                                     {
01562                                       mePosxZmPanel2->Fill( rechitx );
01563                                       mePosyZmPanel2->Fill( rechity );
01564                                       meErrxZmPanel2->Fill( rechiterrx );
01565                                       meErryZmPanel2->Fill( rechiterry );
01566                                       meResxZmPanel2->Fill( rechitresx );
01567                                       meResyZmPanel2->Fill( rechitresy );
01568                                       mePullxZmPanel2->Fill( rechitpullx );
01569                                       mePullyZmPanel2->Fill( rechitpully );
01570                                       meNpixZmPanel2->Fill( npix );
01571                                       meNxpixZmPanel2->Fill( nxpix );
01572                                       meNypixZmPanel2->Fill( nypix );
01573                                       meChargeZmPanel2->Fill( charge );
01574                                       meResXvsAlphaZmPanel2->Fill( alpha, fabs(rechitresx) );
01575                                       meResYvsAlphaZmPanel2->Fill( alpha, fabs(rechitresy) );
01576                                       meResXvsBetaZmPanel2->Fill( beta, fabs(rechitresx) );
01577                                       meResYvsBetaZmPanel2->Fill( beta, fabs(rechitresy) );
01578                                       mePullXvsAlphaZmPanel2->Fill( alpha, rechitpullx );
01579                                       mePullYvsAlphaZmPanel2->Fill( alpha, rechitpully );
01580                                       mePullXvsBetaZmPanel2->Fill( beta, rechitpullx );
01581                                       mePullYvsBetaZmPanel2->Fill( beta, rechitpully );
01582                                       mePullXvsPhiZmPanel2->Fill( phi, rechitpullx );
01583                                       mePullYvsPhiZmPanel2->Fill( phi, rechitpully );
01584                                       mePullXvsEtaZmPanel2->Fill( eta, rechitpullx );
01585                                       mePullYvsEtaZmPanel2->Fill( eta, rechitpully );
01586 
01587                                       meWPullXvsAlphaZmPanel2->Fill( alpha, fabs(rechitpullx) );
01588                                       meWPullYvsAlphaZmPanel2->Fill( alpha, fabs(rechitpully) );
01589                                       meWPullXvsBetaZmPanel2->Fill( beta, fabs(rechitpullx) );
01590                                       meWPullYvsBetaZmPanel2->Fill( beta, fabs(rechitpully) );
01591 
01592                                       mePosxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01593                                       mePosyZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01594                                       meErrxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01595                                       meErryZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01596                                       meResxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01597                                       meResyZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01598                                       mePullxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01599                                       mePullyZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01600                                       meNpixZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( npix );
01601                                       meNxpixZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01602                                       meNypixZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01603                                       meChargeZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( charge );
01604                                       meResXvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01605                                       meResYvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01606                                       meResXvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01607                                       meResYvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01608                                       mePullXvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01609                                       mePullYvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01610                                       mePullXvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01611                                       mePullYvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01612                                       mePullXvsPhiZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01613                                       mePullYvsPhiZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01614                                       mePullXvsEtaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01615                                       mePullYvsEtaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01616 
01617                                     }
01618                                   else LogWarning("SiPixelTrackingRecHitsValid") << "..............................................Wrong panel number !"; 
01619                                 } // if ( side==1 ) 
01620                               else if ( side==2 )
01621                                 {
01622                                   if ( panel==1 )
01623                                     {
01624                                       mePosxZpPanel1->Fill( rechitx );
01625                                       mePosyZpPanel1->Fill( rechity );
01626                                       meErrxZpPanel1->Fill( rechiterrx );
01627                                       meErryZpPanel1->Fill( rechiterry );
01628                                       meResxZpPanel1->Fill( rechitresx );
01629                                       meResyZpPanel1->Fill( rechitresy );
01630                                       mePullxZpPanel1->Fill( rechitpullx );
01631                                       mePullyZpPanel1->Fill( rechitpully );
01632                                       meNpixZpPanel1->Fill( npix );
01633                                       meNxpixZpPanel1->Fill( nxpix );
01634                                       meNypixZpPanel1->Fill( nypix );
01635                                       meChargeZpPanel1->Fill( charge );
01636                                       meResXvsAlphaZpPanel1->Fill( alpha, fabs(rechitresx) );
01637                                       meResYvsAlphaZpPanel1->Fill( alpha, fabs(rechitresy) );
01638                                       meResXvsBetaZpPanel1->Fill( beta, fabs(rechitresx) );
01639                                       meResYvsBetaZpPanel1->Fill( beta, fabs(rechitresy) );
01640                                       mePullXvsAlphaZpPanel1->Fill( alpha, rechitpullx );
01641                                       mePullYvsAlphaZpPanel1->Fill( alpha, rechitpully );
01642                                       mePullXvsBetaZpPanel1->Fill( beta, rechitpullx );
01643                                       mePullYvsBetaZpPanel1->Fill( beta, rechitpully );
01644                                       mePullXvsPhiZpPanel1->Fill( phi, rechitpullx );
01645                                       mePullYvsPhiZpPanel1->Fill( phi, rechitpully );
01646                                       mePullXvsEtaZpPanel1->Fill( eta, rechitpullx );
01647                                       mePullYvsEtaZpPanel1->Fill( eta, rechitpully );
01648 
01649                                       meWPullXvsAlphaZpPanel1->Fill( alpha, fabs(rechitpullx) );
01650                                       meWPullYvsAlphaZpPanel1->Fill( alpha, fabs(rechitpully) );
01651                                       meWPullXvsBetaZpPanel1->Fill( beta, fabs(rechitpullx) );
01652                                       meWPullYvsBetaZpPanel1->Fill( beta, fabs(rechitpully) );
01653 
01654                                       mePosxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01655                                       mePosyZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01656                                       meErrxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01657                                       meErryZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01658                                       meResxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01659                                       meResyZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01660                                       mePullxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01661                                       mePullyZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01662                                       meNpixZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( npix );
01663                                       meNxpixZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01664                                       meNypixZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01665                                       meChargeZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( charge );
01666                                       meResXvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01667                                       meResYvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01668                                       meResXvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01669                                       meResYvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01670                                       mePullXvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01671                                       mePullYvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01672                                       mePullXvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01673                                       mePullYvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01674                                       mePullXvsPhiZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01675                                       mePullYvsPhiZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01676                                       mePullXvsEtaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01677                                       mePullYvsEtaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01678                                       
01679                                     }
01680                                   else if ( panel==2 )
01681                                     {
01682                                       mePosxZpPanel2->Fill( rechitx );
01683                                       mePosyZpPanel2->Fill( rechity );
01684                                       meErrxZpPanel2->Fill( rechiterrx );
01685                                       meErryZpPanel2->Fill( rechiterry );
01686                                       meResxZpPanel2->Fill( rechitresx );
01687                                       meResyZpPanel2->Fill( rechitresy );
01688                                       mePullxZpPanel2->Fill( rechitpullx );
01689                                       mePullyZpPanel2->Fill( rechitpully );
01690                                       meNpixZpPanel2->Fill( npix );
01691                                       meNxpixZpPanel2->Fill( nxpix );
01692                                       meNypixZpPanel2->Fill( nypix );
01693                                       meChargeZpPanel2->Fill( charge );
01694                                       meResXvsAlphaZpPanel2->Fill( alpha, fabs(rechitresx) );
01695                                       meResYvsAlphaZpPanel2->Fill( alpha, fabs(rechitresy) );
01696                                       meResXvsBetaZpPanel2->Fill( beta, fabs(rechitresx) );
01697                                       meResYvsBetaZpPanel2->Fill( beta, fabs(rechitresy) );
01698                                       mePullXvsAlphaZpPanel2->Fill( alpha, rechitpullx );
01699                                       mePullYvsAlphaZpPanel2->Fill( alpha, rechitpully );
01700                                       mePullXvsBetaZpPanel2->Fill( beta, rechitpullx );
01701                                       mePullYvsBetaZpPanel2->Fill( beta, rechitpully );
01702                                       mePullXvsPhiZpPanel2->Fill( phi, rechitpullx );
01703                                       mePullYvsPhiZpPanel2->Fill( phi, rechitpully );
01704                                       mePullXvsEtaZpPanel2->Fill( eta, rechitpullx );
01705                                       mePullYvsEtaZpPanel2->Fill( eta, rechitpully );
01706                                     
01707                                       meWPullXvsAlphaZpPanel2->Fill( alpha, fabs(rechitpullx) );
01708                                       meWPullYvsAlphaZpPanel2->Fill( alpha, fabs(rechitpully) );
01709                                       meWPullXvsBetaZpPanel2->Fill( beta, fabs(rechitpullx) );
01710                                       meWPullYvsBetaZpPanel2->Fill( beta, fabs(rechitpully) );
01711 
01712                                       mePosxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01713                                       mePosyZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01714                                       meErrxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01715                                       meErryZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01716                                       meResxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01717                                       meResyZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01718                                       mePullxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01719                                       mePullyZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01720                                       meNpixZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( npix );
01721                                       meNxpixZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01722                                       meNypixZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01723                                       meChargeZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( charge );
01724                                       meResXvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01725                                       meResYvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01726                                       meResXvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01727                                       meResYvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01728                                       mePullXvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01729                                       mePullYvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01730                                       mePullXvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01731                                       mePullYvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01732                                       mePullXvsPhiZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01733                                       mePullYvsPhiZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01734                                       mePullXvsEtaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01735                                       mePullYvsEtaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01736 
01737                                     }
01738                                   else LogWarning("SiPixelTrackingRecHitsValid") << "..............................................Wrong panel number !"; 
01739                                 } //else if ( side==2 )
01740                               else LogWarning("SiPixelTrackingRecHitsValid") << ".......................................................Wrong side !" ;
01741                               
01742                             } // else if ( detId.subdetId()==PixelSubdetector::PixelEndcap )
01743                           else LogWarning("SiPixelTrackingRecHitsValid") << "Pixel rechit but we are not in the pixel detector" << (int)detId.subdetId() ;
01744                           
01745                           if(debugNtuple_.size()!=0)t_->Fill();
01746 
01747                         } // if ( !matched.empty() )
01748                       //else
01749                       //cout << "---------------- RecHit with no associated SimHit !!! -------------------------- " << endl;
01750                       
01751                     } // matchedhit.
01752                   
01753                 } // end of loop on hits
01754               
01755               mePixRecHitsPerTrack->Fill( n_hits );
01756               //cout << "n_hits = " << n_hits << endl;
01757               
01758             } //end of loop on track 
01759           
01760         } // tracks > 0.
01761       
01762     } //end of MTCCTrack
01763 
01764 }