CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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/TrackerCommon/interface/TrackerTopology.h"
00032 #include "Geometry/Records/interface/IdealGeometryRecord.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   //Retrieve tracker topology from geometry
01075   edm::ESHandle<TrackerTopology> tTopo;
01076   es.get<IdealGeometryRecord>().get(tTopo);
01077 
01078 
01079   run = e.id().run();
01080   evt = e.id().event();
01081 
01082   //  if ( evt%1000 == 0 ) 
01083     //cout << "evt = " << evt << endl;
01084   
01085   float math_pi = 3.14159265;
01086   float radtodeg = 180.0 / math_pi;
01087     
01088   DetId detId;
01089 
01090   LocalPoint position;
01091   LocalError error;
01092   float mindist = 999999.9;
01093 
01094   std::vector<PSimHit> matched;
01095   TrackerHitAssociator associate(e,conf_);
01096 
01097   edm::ESHandle<TrackerGeometry> pDD;
01098   es.get<TrackerDigiGeometryRecord> ().get (pDD);
01099   const TrackerGeometry* tracker = &(* pDD);
01100 
01101   if ( !MTCCtrack_ )
01102     {
01103       // --------------------------------------- all hits -----------------------------------------------------------
01104       //--- Fetch Pixel RecHits
01105       edm::Handle<SiPixelRecHitCollection> recHitColl;
01106       e.getByLabel( "siPixelRecHits", recHitColl);
01107       
01108       //cout <<" ----- Found " 
01109       //   << const_cast<SiPixelRecHitCollection*>(recHitColl.product())->size()
01110       //   << " Pixel RecHits" << std::endl;
01111   
01112       //-----Iterate over detunits
01113       for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) 
01114         {
01115           DetId detId = ((*it)->geographicalId());
01116          
01117           unsigned int subid = detId.subdetId();
01118           if ( !((subid==1) || (subid==2)) ) 
01119             continue; // end subid if
01120 
01121           SiPixelRecHitCollection::const_iterator match = recHitColl->find(detId);
01122           if (match == recHitColl->end()) continue;
01123 
01124           SiPixelRecHitCollection::DetSet pixelrechitRange = *match;
01125           SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorBegin = pixelrechitRange.begin();
01126           SiPixelRecHitCollection::DetSet::const_iterator pixelrechitRangeIteratorEnd = pixelrechitRange.end();
01127           SiPixelRecHitCollection::DetSet::const_iterator pixeliter = pixelrechitRangeIteratorBegin;
01128           std::vector<PSimHit> matched;
01129           
01130           //----Loop over rechits for this detId
01131           for ( ; pixeliter != pixelrechitRangeIteratorEnd; ++pixeliter) 
01132             {
01133               LocalPoint lp = pixeliter->localPosition();
01134               float rechitx = lp.x();
01135               float rechity = lp.y();
01136              
01137               detId = (*it)->geographicalId();
01138               subdetId = (int)detId.subdetId();
01139               if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel ) 
01140                 {
01141                   mePosxBarrel_all_hits->Fill( rechitx );
01142                   mePosyBarrel_all_hits->Fill( rechity );
01143                 }
01144               else if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap )
01145                 {
01146                   
01147                   side  = tTopo->pxfSide(detId);
01148                   disk  = tTopo->pxfDisk(detId);
01149                   blade = tTopo->pxfBlade(detId);
01150                   panel = tTopo->pxfPanel(detId);
01151                   plaq  = tTopo->pxfModule(detId); // also known as plaquette
01152                   
01153                   if ( side==1 ) 
01154                     {
01155                       if ( panel==1 )
01156                         {
01157                           mePosxZmPanel1_all_hits->Fill( rechitx );
01158                           mePosyZmPanel1_all_hits->Fill( rechity );
01159                         }
01160                       else if ( panel==2 )
01161                         {
01162                           mePosxZmPanel2_all_hits->Fill( rechitx );
01163                           mePosyZmPanel2_all_hits->Fill( rechity );
01164                         }
01165                       else LogWarning("SiPixelTrackingRecHitsValid") << "..............................................Wrong panel number !"; 
01166                     } // if ( side==1 ) 
01167                   else if ( side==2 )
01168                     {
01169                       if ( panel==1 )
01170                         {
01171                           mePosxZpPanel1_all_hits->Fill( rechitx );
01172                           mePosyZpPanel1_all_hits->Fill( rechity );
01173                         }
01174                        else if ( panel==2 )
01175                          {
01176                            mePosxZpPanel2_all_hits->Fill( rechitx );
01177                            mePosyZpPanel2_all_hits->Fill( rechity );
01178                          }
01179                        else  LogWarning("SiPixelTrackingRecHitsValid")<< "..............................................Wrong panel number !";
01180                     } //else if ( side==2 )
01181                   else LogWarning("SiPixelTrackingRecHitsValid") << ".......................................................Wrong side !" ;
01182                   
01183                 } // else if ( detId.subdetId()==PixelSubdetector::PixelEndcap )
01184               else LogWarning("SiPixelTrackingRecHitsValid") << "Pixel rechit collection but we are not in the pixel detector" << (int)detId.subdetId() ;
01185               
01186             }
01187         }
01188       // ------------------------------------------------ all hits ---------------------------------------------------------------
01189        
01190       // Get tracks
01191       edm::Handle<reco::TrackCollection> trackCollection;
01192       e.getByLabel(src_, trackCollection);
01193       const reco::TrackCollection *tracks = trackCollection.product();
01194       reco::TrackCollection::const_iterator tciter;
01195 
01196       int n_tracks = (int)tracks->size(); // number of tracks in this event
01197       meTracksPerEvent->Fill( n_tracks );
01198 
01199       if ( tracks->size() > 0 )
01200         {
01201           // Loop on tracks
01202           for ( tciter=tracks->begin(); tciter!=tracks->end(); tciter++)
01203             {
01204               phi = tciter->momentum().phi() / math_pi*180.0;
01205               eta = tciter->momentum().eta();
01206               
01207               int n_hits = 0;
01208               // First loop on hits: find matched hits
01209               for ( trackingRecHit_iterator it = tciter->recHitsBegin(); it != tciter->recHitsEnd(); it++) 
01210                 {
01211                   const TrackingRecHit &thit = **it;
01212                   // Is it a matched hit?
01213                   const SiPixelRecHit* matchedhit = dynamic_cast<const SiPixelRecHit*>(&thit);
01214                   
01215                   if ( matchedhit ) 
01216                     {
01217                       ++n_hits;
01218                       
01219                       layer  = -9999; 
01220                       ladder = -9999; 
01221                       mod    = -9999; 
01222                       side   = -9999;  
01223                       disk   = -9999;  
01224                       blade  = -9999; 
01225                       panel  = -9999; 
01226                       plaq   = -9999; 
01227 
01228                       rechitx = -9999.9;
01229                       rechity = -9999.9;
01230                       rechitz = -9999.9;
01231                       rechiterrx = -9999.9;
01232                       rechiterry = -9999.9;                   
01233                       rechitresx = -9999.9;
01234                       rechitresy = -9999.9;
01235                       rechitpullx = -9999.9;
01236                       rechitpully = -9999.9;
01237                       
01238                       npix = -9999;
01239                       nxpix = -9999;
01240                       nypix = -9999;
01241                       charge = -9999.9;
01242                       
01243                       alpha = -9999.9;
01244                       beta  = -9999.9;
01245 
01246                       half = -9999;
01247                       flipped = -9999;
01248                  
01249                       nsimhit = -9999;
01250                          
01251                       simhitx = -9999.9;
01252                       simhity = -9999.9;
01253 
01254                       position = (*it)->localPosition();
01255                       error = (*it)->localPositionError();
01256 
01257                       rechitx = position.x();
01258                       rechity = position.y();
01259                       rechitz = position.z();
01260                       rechiterrx = sqrt(error.xx());
01261                       rechiterry = sqrt(error.yy());
01262 
01263                       npix = (*matchedhit).cluster()->size();
01264                       nxpix = (*matchedhit).cluster()->sizeX();
01265                       nypix = (*matchedhit).cluster()->sizeY();
01266                       charge = (*matchedhit).cluster()->charge();
01267 
01268                       //Association of the rechit to the simhit
01269                       matched.clear();
01270                       matched = associate.associateHit(*matchedhit);
01271 
01272                       nsimhit = (int)matched.size();
01273 
01274                       if ( !matched.empty() ) 
01275                         {
01276                           mindist = 999999.9;
01277                           float distx, disty, dist;
01278                           bool found_hit_from_generated_particle = false;
01279                           
01280                           int n_assoc_muon = 0;
01281 
01282                           vector<PSimHit>::const_iterator closestit = matched.begin();
01283                           for (vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++)
01284                             {
01285                               if ( checkType_ )
01286                                 {
01287                                   int pid = (*m).particleType();
01288                                   if ( abs(pid) != genType_ )
01289                                     continue;
01290                                   
01291                                 }
01292                               
01293                               float simhitx = 0.5 * ( (*m).entryPoint().x() + (*m).exitPoint().x() );
01294                               float simhity = 0.5 * ( (*m).entryPoint().y() + (*m).exitPoint().y() );
01295                               
01296                               distx = fabs(rechitx - simhitx);
01297                               disty = fabs(rechity - simhity);
01298                               dist = sqrt( distx*distx + disty*disty );
01299         
01300                               if ( dist < mindist )
01301                                 {
01302                                   n_assoc_muon++;
01303 
01304                                   mindist = dist;
01305                                   closestit = m;
01306                                   found_hit_from_generated_particle = true;
01307                                 }
01308                             } // for (vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++)
01309                           
01310                           // This recHit does not have any simHit with the same particleType as the particles generated
01311                           // Ignore it as most probably come from delta rays.
01312                           if ( checkType_ && !found_hit_from_generated_particle )
01313                             continue; 
01314                           
01315                           if ( n_assoc_muon > 1 )
01316                             {
01317                               LogWarning("SiPixelTrackingRecHitsValid") << " ----- This is not good: n_assoc_muon = " << n_assoc_muon ;
01318                               LogWarning("SiPixelTrackingRecHitsValid") << "evt = " << evt ;
01319                             }
01320 
01321                           pidhit = (*closestit).particleType();
01322 
01323                           simhitx = 0.5*( (*closestit).entryPoint().x() + (*closestit).exitPoint().x() );
01324                           simhity = 0.5*( (*closestit).entryPoint().y() + (*closestit).exitPoint().y() );
01325                           
01326                           rechitresx = rechitx - simhitx;
01327                           rechitresy = rechity - simhity;
01328                           rechitpullx = ( rechitx - simhitx ) / sqrt(error.xx());
01329                           rechitpully = ( rechity - simhity ) / sqrt(error.yy());
01330 
01331                           float simhitpx = (*closestit).momentumAtEntry().x();
01332                           float simhitpy = (*closestit).momentumAtEntry().y();
01333                           float simhitpz = (*closestit).momentumAtEntry().z();
01334                                                   
01335                           //beta  = atan2(simhitpz, simhitpy) * radtodeg;
01336                           //alpha = atan2(simhitpz, simhitpx) * radtodeg;
01337                           
01338                           beta  = fabs(atan2(simhitpz, simhitpy)) * radtodeg;
01339                           alpha = fabs(atan2(simhitpz, simhitpx)) * radtodeg;
01340                 
01341                           detId = (*it)->geographicalId();
01342 
01343                           subdetId = (int)detId.subdetId();
01344 
01345                           if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel ) 
01346                             {
01347                               mePosxBarrel->Fill( rechitx );
01348                               mePosyBarrel->Fill( rechity );
01349                               meErrxBarrel->Fill( rechiterrx );                       
01350                               meErryBarrel->Fill( rechiterry );
01351                               meResxBarrel->Fill( rechitresx );
01352                               meResyBarrel->Fill( rechitresy );
01353                               mePullxBarrel->Fill( rechitpullx );
01354                               mePullyBarrel->Fill( rechitpully );
01355                               meNpixBarrel->Fill( npix );
01356                               meNxpixBarrel->Fill( nxpix );
01357                               meNypixBarrel->Fill( nypix );
01358                               meChargeBarrel->Fill( charge );
01359                               meResXvsAlphaBarrel->Fill( alpha, fabs(rechitresx) );
01360                               meResYvsAlphaBarrel->Fill( alpha, fabs(rechitresy) );
01361                               meResXvsBetaBarrel->Fill( beta, fabs(rechitresx) );
01362                               meResYvsBetaBarrel->Fill( beta, fabs(rechitresy) );
01363                               mePullXvsAlphaBarrel->Fill( alpha, rechitpullx );
01364                               mePullYvsAlphaBarrel->Fill( alpha, rechitpully );
01365                               mePullXvsBetaBarrel->Fill( beta, rechitpullx );
01366                               mePullYvsBetaBarrel->Fill( beta, rechitpully );
01367                               mePullXvsPhiBarrel->Fill( phi, rechitpullx );
01368                               mePullYvsPhiBarrel->Fill( phi, rechitpully );
01369                               mePullXvsEtaBarrel->Fill( eta, rechitpullx );
01370                               mePullYvsEtaBarrel->Fill( eta, rechitpully );
01371                               
01372                               const PixelGeomDetUnit * theGeomDet 
01373                                 = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(detId) );
01374                               //const PixelTopology * topol = (&(theGeomDet->specificTopology()));
01375                               
01376                               int tmp_nrows = theGeomDet->specificTopology().nrows();
01377                               
01378                               if ( tmp_nrows == 80 ) 
01379                                 {
01380                                   mePosxBarrelHalfModule->Fill( rechitx );
01381                                   mePosyBarrelHalfModule->Fill( rechity );
01382                                   half = 1;
01383                                 }
01384                               else if ( tmp_nrows == 160 ) 
01385                                 {
01386                                   mePosxBarrelFullModule->Fill( rechitx );
01387                                   mePosyBarrelFullModule->Fill( rechity );
01388                                   half = 0;
01389                                 }
01390                               else 
01391                                 LogWarning("SiPixelTrackingRecHitsValid") << "-------------------------------------------------- Wrong module size !!!";
01392 
01393                               float tmp1 = theGeomDet->surface().toGlobal(Local3DPoint(0.,0.,0.)).perp();
01394                               float tmp2 = theGeomDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp();
01395                               
01396                               if ( tmp2<tmp1 ) 
01397                                 { // flipped
01398                                   mePosxBarrelFlippedLadders->Fill( rechitx );
01399                                   mePosyBarrelFlippedLadders->Fill( rechity );
01400                                   flipped = 1;
01401                                 
01402                                   meResXvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitresx) );
01403                                   meResYvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitresy) );
01404                                   meResXvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitresx) );
01405                                   meResYvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitresy) );
01406                                   mePullXvsAlphaBarrelFlippedLadders->Fill( alpha, rechitpullx );
01407                                   mePullYvsAlphaBarrelFlippedLadders->Fill( alpha, rechitpully );
01408                                   mePullXvsBetaBarrelFlippedLadders->Fill( beta, rechitpullx );
01409                                   mePullYvsBetaBarrelFlippedLadders->Fill( beta, rechitpully );
01410                                   mePullXvsPhiBarrelFlippedLadders->Fill( phi, rechitpullx );
01411                                   mePullYvsPhiBarrelFlippedLadders->Fill( phi, rechitpully );
01412                                   mePullXvsEtaBarrelFlippedLadders->Fill( eta, rechitpullx );
01413                                   mePullYvsEtaBarrelFlippedLadders->Fill( eta, rechitpully );
01414                                 
01415                                   meWPullXvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitpullx) );
01416                                   meWPullYvsAlphaBarrelFlippedLadders->Fill( alpha, fabs(rechitpully) );
01417                                   meWPullXvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitpullx) );
01418                                   meWPullYvsBetaBarrelFlippedLadders->Fill( beta, fabs(rechitpully) );
01419                                 }
01420                               else 
01421                                 { // not flipped
01422                                   mePosxBarrelNonFlippedLadders->Fill( rechitx );
01423                                   mePosyBarrelNonFlippedLadders->Fill( rechity );
01424                                   flipped = 0;
01425                                 
01426                                   meResXvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitresx) );
01427                                   meResYvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitresy) );
01428                                   meResXvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitresx) );
01429                                   meResYvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitresy) );
01430                                   mePullXvsAlphaBarrelNonFlippedLadders->Fill( alpha, rechitpullx );
01431                                   mePullYvsAlphaBarrelNonFlippedLadders->Fill( alpha, rechitpully );
01432                                   mePullXvsBetaBarrelNonFlippedLadders->Fill( beta, rechitpullx );
01433                                   mePullYvsBetaBarrelNonFlippedLadders->Fill( beta, rechitpully );
01434                                   mePullXvsPhiBarrelNonFlippedLadders->Fill( phi, rechitpullx );
01435                                   mePullYvsPhiBarrelNonFlippedLadders->Fill( phi, rechitpully );
01436                                   mePullXvsEtaBarrelNonFlippedLadders->Fill( eta, rechitpullx );
01437                                   mePullYvsEtaBarrelNonFlippedLadders->Fill( eta, rechitpully );
01438 
01439                                   meWPullXvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitpullx) );
01440                                   meWPullYvsAlphaBarrelNonFlippedLadders->Fill( alpha, fabs(rechitpully) );
01441                                   meWPullXvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitpullx) );
01442                                   meWPullYvsBetaBarrelNonFlippedLadders->Fill( beta, fabs(rechitpully) );
01443                                 }
01444                                   
01445                               
01446                               layer  = tTopo->pxbLayer(detId);   // Layer: 1,2,3.
01447                               ladder = tTopo->pxbLadder(detId);  // Ladder: 1-20, 32, 44. 
01448                               mod   = tTopo->pxbModule(detId);  // Mod: 1-8.
01449                               
01450                               mePosxBarrelLayerModule[layer-1][mod-1]->Fill( rechitx );
01451                               mePosyBarrelLayerModule[layer-1][mod-1]->Fill( rechity );
01452                               meErrxBarrelLayerModule[layer-1][mod-1]->Fill( rechiterrx );
01453                               meErryBarrelLayerModule[layer-1][mod-1]->Fill( rechiterry );
01454                               meResxBarrelLayerModule[layer-1][mod-1]->Fill( rechitresx );
01455                               meResyBarrelLayerModule[layer-1][mod-1]->Fill( rechitresy );
01456                               mePullxBarrelLayerModule[layer-1][mod-1]->Fill( rechitpullx );
01457                               mePullyBarrelLayerModule[layer-1][mod-1]->Fill( rechitpully );
01458                               meNpixBarrelLayerModule[layer-1][mod-1]->Fill( npix );
01459                               meNxpixBarrelLayerModule[layer-1][mod-1]->Fill( nxpix );
01460                               meNypixBarrelLayerModule[layer-1][mod-1]->Fill( nypix );
01461                               meChargeBarrelLayerModule[layer-1][mod-1]->Fill( charge );
01462                               meResXvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, fabs(rechitresx) );
01463                               meResYvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, fabs(rechitresy) );
01464                               meResXvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, fabs(rechitresx) );
01465                               meResYvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, fabs(rechitresy) );
01466                               mePullXvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, rechitpullx );
01467                               mePullYvsAlphaBarrelLayerModule[layer-1][mod-1]->Fill( alpha, rechitpully );
01468                               mePullXvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, rechitpullx );
01469                               mePullYvsBetaBarrelLayerModule[layer-1][mod-1]->Fill( beta, rechitpully );
01470                               mePullXvsPhiBarrelLayerModule[layer-1][mod-1]->Fill( phi, rechitpullx );
01471                               mePullYvsPhiBarrelLayerModule[layer-1][mod-1]->Fill( phi, rechitpully );
01472                               mePullXvsEtaBarrelLayerModule[layer-1][mod-1]->Fill( eta, rechitpullx );
01473                               mePullYvsEtaBarrelLayerModule[layer-1][mod-1]->Fill( eta, rechitpully );
01474                             
01475                               meResxBarrelLayer[layer-1]->Fill( rechitresx );
01476                               meResyBarrelLayer[layer-1]->Fill( rechitresy );
01477                               mePullxBarrelLayer[layer-1]->Fill( rechitpullx );
01478                               mePullyBarrelLayer[layer-1]->Fill( rechitpully );
01479 
01480                               if ( tmp2<tmp1 ) 
01481                                 { // flipped
01482                                   meResXvsAlphaBarrelFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresx) );
01483                                   meResYvsAlphaBarrelFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresy) );
01484                                   meResXvsBetaBarrelFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresx) );
01485                                   meResYvsBetaBarrelFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresy) );
01486                                 }
01487                               else
01488                                 { // not flipped
01489                                   meResXvsAlphaBarrelNonFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresx) );
01490                                   meResYvsAlphaBarrelNonFlippedLaddersLayer[layer-1]->Fill( alpha, fabs(rechitresy) );
01491                                   meResXvsBetaBarrelNonFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresx) );
01492                                   meResYvsBetaBarrelNonFlippedLaddersLayer[layer-1]->Fill( beta, fabs(rechitresy) );
01493                                 }
01494                               
01495                             }
01496                           else if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap )
01497                             {
01498                               
01499                               side  = tTopo->pxfSide(detId);
01500                               disk  = tTopo->pxfDisk(detId);
01501                               blade = tTopo->pxfBlade(detId);
01502                               panel = tTopo->pxfPanel(detId);
01503                               plaq  = tTopo->pxfModule(detId); // also known as plaquette
01504 
01505                               if ( side==1 ) 
01506                                 {
01507                                   if ( panel==1 )
01508                                     {
01509                                       mePosxZmPanel1->Fill( rechitx );
01510                                       mePosyZmPanel1->Fill( rechity );
01511                                       meErrxZmPanel1->Fill( rechiterrx );
01512                                       meErryZmPanel1->Fill( rechiterry );
01513                                       meResxZmPanel1->Fill( rechitresx );
01514                                       meResyZmPanel1->Fill( rechitresy );
01515                                       mePullxZmPanel1->Fill( rechitpullx );
01516                                       mePullyZmPanel1->Fill( rechitpully );
01517                                       meNpixZmPanel1->Fill( npix );
01518                                       meNxpixZmPanel1->Fill( nxpix );
01519                                       meNypixZmPanel1->Fill( nypix );
01520                                       meChargeZmPanel1->Fill( charge );
01521                                       meResXvsAlphaZmPanel1->Fill( alpha, fabs(rechitresx) );
01522                                       meResYvsAlphaZmPanel1->Fill( alpha, fabs(rechitresy) );
01523                                       meResXvsBetaZmPanel1->Fill( beta, fabs(rechitresx) );
01524                                       meResYvsBetaZmPanel1->Fill( beta, fabs(rechitresy) );
01525                                       mePullXvsAlphaZmPanel1->Fill( alpha, rechitpullx );
01526                                       mePullYvsAlphaZmPanel1->Fill( alpha, rechitpully );
01527                                       mePullXvsBetaZmPanel1->Fill( beta, rechitpullx );
01528                                       mePullYvsBetaZmPanel1->Fill( beta, rechitpully );
01529                                       mePullXvsPhiZmPanel1->Fill( phi, rechitpullx );
01530                                       mePullYvsPhiZmPanel1->Fill( phi, rechitpully );
01531                                       mePullXvsEtaZmPanel1->Fill( eta, rechitpullx );
01532                                       mePullYvsEtaZmPanel1->Fill( eta, rechitpully );
01533                                       
01534                                       meWPullXvsAlphaZmPanel1->Fill( alpha, fabs(rechitpullx) );
01535                                       meWPullYvsAlphaZmPanel1->Fill( alpha, fabs(rechitpully) );
01536                                       meWPullXvsBetaZmPanel1->Fill( beta, fabs(rechitpullx) );
01537                                       meWPullYvsBetaZmPanel1->Fill( beta, fabs(rechitpully) );
01538       
01539                                       mePosxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01540                                       mePosyZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01541                                       meErrxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01542                                       meErryZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01543                                       meResxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01544                                       meResyZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01545                                       mePullxZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01546                                       mePullyZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01547                                       meNpixZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( npix );
01548                                       meNxpixZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01549                                       meNypixZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01550                                       meChargeZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( charge );
01551                                       meResXvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01552                                       meResYvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01553                                       meResXvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01554                                       meResYvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01555                                       mePullXvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01556                                       mePullYvsAlphaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01557                                       mePullXvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01558                                       mePullYvsBetaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01559                                       mePullXvsPhiZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01560                                       mePullYvsPhiZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01561                                       mePullXvsEtaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01562                                       mePullYvsEtaZmPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01563                                       
01564                                     }
01565                                   else if ( panel==2 )
01566                                     {
01567                                       mePosxZmPanel2->Fill( rechitx );
01568                                       mePosyZmPanel2->Fill( rechity );
01569                                       meErrxZmPanel2->Fill( rechiterrx );
01570                                       meErryZmPanel2->Fill( rechiterry );
01571                                       meResxZmPanel2->Fill( rechitresx );
01572                                       meResyZmPanel2->Fill( rechitresy );
01573                                       mePullxZmPanel2->Fill( rechitpullx );
01574                                       mePullyZmPanel2->Fill( rechitpully );
01575                                       meNpixZmPanel2->Fill( npix );
01576                                       meNxpixZmPanel2->Fill( nxpix );
01577                                       meNypixZmPanel2->Fill( nypix );
01578                                       meChargeZmPanel2->Fill( charge );
01579                                       meResXvsAlphaZmPanel2->Fill( alpha, fabs(rechitresx) );
01580                                       meResYvsAlphaZmPanel2->Fill( alpha, fabs(rechitresy) );
01581                                       meResXvsBetaZmPanel2->Fill( beta, fabs(rechitresx) );
01582                                       meResYvsBetaZmPanel2->Fill( beta, fabs(rechitresy) );
01583                                       mePullXvsAlphaZmPanel2->Fill( alpha, rechitpullx );
01584                                       mePullYvsAlphaZmPanel2->Fill( alpha, rechitpully );
01585                                       mePullXvsBetaZmPanel2->Fill( beta, rechitpullx );
01586                                       mePullYvsBetaZmPanel2->Fill( beta, rechitpully );
01587                                       mePullXvsPhiZmPanel2->Fill( phi, rechitpullx );
01588                                       mePullYvsPhiZmPanel2->Fill( phi, rechitpully );
01589                                       mePullXvsEtaZmPanel2->Fill( eta, rechitpullx );
01590                                       mePullYvsEtaZmPanel2->Fill( eta, rechitpully );
01591 
01592                                       meWPullXvsAlphaZmPanel2->Fill( alpha, fabs(rechitpullx) );
01593                                       meWPullYvsAlphaZmPanel2->Fill( alpha, fabs(rechitpully) );
01594                                       meWPullXvsBetaZmPanel2->Fill( beta, fabs(rechitpullx) );
01595                                       meWPullYvsBetaZmPanel2->Fill( beta, fabs(rechitpully) );
01596 
01597                                       mePosxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01598                                       mePosyZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01599                                       meErrxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01600                                       meErryZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01601                                       meResxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01602                                       meResyZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01603                                       mePullxZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01604                                       mePullyZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01605                                       meNpixZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( npix );
01606                                       meNxpixZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01607                                       meNypixZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01608                                       meChargeZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( charge );
01609                                       meResXvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01610                                       meResYvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01611                                       meResXvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01612                                       meResYvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01613                                       mePullXvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01614                                       mePullYvsAlphaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01615                                       mePullXvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01616                                       mePullYvsBetaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01617                                       mePullXvsPhiZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01618                                       mePullYvsPhiZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01619                                       mePullXvsEtaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01620                                       mePullYvsEtaZmPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01621 
01622                                     }
01623                                   else LogWarning("SiPixelTrackingRecHitsValid") << "..............................................Wrong panel number !"; 
01624                                 } // if ( side==1 ) 
01625                               else if ( side==2 )
01626                                 {
01627                                   if ( panel==1 )
01628                                     {
01629                                       mePosxZpPanel1->Fill( rechitx );
01630                                       mePosyZpPanel1->Fill( rechity );
01631                                       meErrxZpPanel1->Fill( rechiterrx );
01632                                       meErryZpPanel1->Fill( rechiterry );
01633                                       meResxZpPanel1->Fill( rechitresx );
01634                                       meResyZpPanel1->Fill( rechitresy );
01635                                       mePullxZpPanel1->Fill( rechitpullx );
01636                                       mePullyZpPanel1->Fill( rechitpully );
01637                                       meNpixZpPanel1->Fill( npix );
01638                                       meNxpixZpPanel1->Fill( nxpix );
01639                                       meNypixZpPanel1->Fill( nypix );
01640                                       meChargeZpPanel1->Fill( charge );
01641                                       meResXvsAlphaZpPanel1->Fill( alpha, fabs(rechitresx) );
01642                                       meResYvsAlphaZpPanel1->Fill( alpha, fabs(rechitresy) );
01643                                       meResXvsBetaZpPanel1->Fill( beta, fabs(rechitresx) );
01644                                       meResYvsBetaZpPanel1->Fill( beta, fabs(rechitresy) );
01645                                       mePullXvsAlphaZpPanel1->Fill( alpha, rechitpullx );
01646                                       mePullYvsAlphaZpPanel1->Fill( alpha, rechitpully );
01647                                       mePullXvsBetaZpPanel1->Fill( beta, rechitpullx );
01648                                       mePullYvsBetaZpPanel1->Fill( beta, rechitpully );
01649                                       mePullXvsPhiZpPanel1->Fill( phi, rechitpullx );
01650                                       mePullYvsPhiZpPanel1->Fill( phi, rechitpully );
01651                                       mePullXvsEtaZpPanel1->Fill( eta, rechitpullx );
01652                                       mePullYvsEtaZpPanel1->Fill( eta, rechitpully );
01653 
01654                                       meWPullXvsAlphaZpPanel1->Fill( alpha, fabs(rechitpullx) );
01655                                       meWPullYvsAlphaZpPanel1->Fill( alpha, fabs(rechitpully) );
01656                                       meWPullXvsBetaZpPanel1->Fill( beta, fabs(rechitpullx) );
01657                                       meWPullYvsBetaZpPanel1->Fill( beta, fabs(rechitpully) );
01658 
01659                                       mePosxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01660                                       mePosyZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01661                                       meErrxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01662                                       meErryZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01663                                       meResxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01664                                       meResyZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01665                                       mePullxZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01666                                       mePullyZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01667                                       meNpixZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( npix );
01668                                       meNxpixZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01669                                       meNypixZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01670                                       meChargeZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( charge );
01671                                       meResXvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01672                                       meResYvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01673                                       meResXvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01674                                       meResYvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01675                                       mePullXvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01676                                       mePullYvsAlphaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01677                                       mePullXvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01678                                       mePullYvsBetaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01679                                       mePullXvsPhiZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01680                                       mePullYvsPhiZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01681                                       mePullXvsEtaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01682                                       mePullYvsEtaZpPanel1DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01683                                       
01684                                     }
01685                                   else if ( panel==2 )
01686                                     {
01687                                       mePosxZpPanel2->Fill( rechitx );
01688                                       mePosyZpPanel2->Fill( rechity );
01689                                       meErrxZpPanel2->Fill( rechiterrx );
01690                                       meErryZpPanel2->Fill( rechiterry );
01691                                       meResxZpPanel2->Fill( rechitresx );
01692                                       meResyZpPanel2->Fill( rechitresy );
01693                                       mePullxZpPanel2->Fill( rechitpullx );
01694                                       mePullyZpPanel2->Fill( rechitpully );
01695                                       meNpixZpPanel2->Fill( npix );
01696                                       meNxpixZpPanel2->Fill( nxpix );
01697                                       meNypixZpPanel2->Fill( nypix );
01698                                       meChargeZpPanel2->Fill( charge );
01699                                       meResXvsAlphaZpPanel2->Fill( alpha, fabs(rechitresx) );
01700                                       meResYvsAlphaZpPanel2->Fill( alpha, fabs(rechitresy) );
01701                                       meResXvsBetaZpPanel2->Fill( beta, fabs(rechitresx) );
01702                                       meResYvsBetaZpPanel2->Fill( beta, fabs(rechitresy) );
01703                                       mePullXvsAlphaZpPanel2->Fill( alpha, rechitpullx );
01704                                       mePullYvsAlphaZpPanel2->Fill( alpha, rechitpully );
01705                                       mePullXvsBetaZpPanel2->Fill( beta, rechitpullx );
01706                                       mePullYvsBetaZpPanel2->Fill( beta, rechitpully );
01707                                       mePullXvsPhiZpPanel2->Fill( phi, rechitpullx );
01708                                       mePullYvsPhiZpPanel2->Fill( phi, rechitpully );
01709                                       mePullXvsEtaZpPanel2->Fill( eta, rechitpullx );
01710                                       mePullYvsEtaZpPanel2->Fill( eta, rechitpully );
01711                                     
01712                                       meWPullXvsAlphaZpPanel2->Fill( alpha, fabs(rechitpullx) );
01713                                       meWPullYvsAlphaZpPanel2->Fill( alpha, fabs(rechitpully) );
01714                                       meWPullXvsBetaZpPanel2->Fill( beta, fabs(rechitpullx) );
01715                                       meWPullYvsBetaZpPanel2->Fill( beta, fabs(rechitpully) );
01716 
01717                                       mePosxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitx );
01718                                       mePosyZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechity );
01719                                       meErrxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterrx );
01720                                       meErryZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechiterry );
01721                                       meResxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresx );
01722                                       meResyZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitresy );
01723                                       mePullxZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpullx );
01724                                       mePullyZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( rechitpully );
01725                                       meNpixZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( npix );
01726                                       meNxpixZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( nxpix );
01727                                       meNypixZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( nypix );
01728                                       meChargeZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( charge );
01729                                       meResXvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresx) );
01730                                       meResYvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, fabs(rechitresy) );
01731                                       meResXvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresx) );
01732                                       meResYvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, fabs(rechitresy) );
01733                                       mePullXvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpullx );
01734                                       mePullYvsAlphaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( alpha, rechitpully );
01735                                       mePullXvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpullx );
01736                                       mePullYvsBetaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( beta, rechitpully );
01737                                       mePullXvsPhiZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpullx );
01738                                       mePullYvsPhiZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( phi, rechitpully );
01739                                       mePullXvsEtaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpullx );
01740                                       mePullYvsEtaZpPanel2DiskPlaq[disk-1][plaq-1]->Fill( eta, rechitpully );
01741 
01742                                     }
01743                                   else LogWarning("SiPixelTrackingRecHitsValid") << "..............................................Wrong panel number !"; 
01744                                 } //else if ( side==2 )
01745                               else LogWarning("SiPixelTrackingRecHitsValid") << ".......................................................Wrong side !" ;
01746                               
01747                             } // else if ( detId.subdetId()==PixelSubdetector::PixelEndcap )
01748                           else LogWarning("SiPixelTrackingRecHitsValid") << "Pixel rechit but we are not in the pixel detector" << (int)detId.subdetId() ;
01749                           
01750                           if(debugNtuple_.size()!=0)t_->Fill();
01751 
01752                         } // if ( !matched.empty() )
01753                       //else
01754                       //cout << "---------------- RecHit with no associated SimHit !!! -------------------------- " << endl;
01755                       
01756                     } // matchedhit.
01757                   
01758                 } // end of loop on hits
01759               
01760               mePixRecHitsPerTrack->Fill( n_hits );
01761               //cout << "n_hits = " << n_hits << endl;
01762               
01763             } //end of loop on track 
01764           
01765         } // tracks > 0.
01766       
01767     } //end of MTCCTrack
01768 
01769 }