CMS 3D CMS Logo

SiStripTrackingRecHitsValid.cc

Go to the documentation of this file.
00001 // File: SiStripTrackingRecHitsValid.cc
00002 // // Author:  Arnaud Gay.
00003 // Creation Date:  July 2006.
00004 //
00005 //--------------------------------------------
00006 
00007 #include <memory>
00008 #include <string>
00009 #include <iostream>
00010 #include <TMath.h>
00011 #include "Validation/RecoTrack/interface/SiStripTrackingRecHitsValid.h"
00012 
00013 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00014 #include "FWCore/Framework/interface/ESHandle.h"
00015 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00016 
00017 #include "DataFormats/GeometryVector/interface/LocalVector.h"
00018 
00019 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00020 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00021 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
00022 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00023 
00024 #include "DataFormats/TrackReco/interface/Track.h"
00025 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00026 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
00027 #include "DataFormats/DetId/interface/DetId.h" 
00028 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" 
00029 #include "DataFormats/SiStripDetId/interface/TECDetId.h" 
00030 #include "DataFormats/SiStripDetId/interface/TIBDetId.h" 
00031 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00032 #include "DataFormats/SiStripDetId/interface/TOBDetId.h" 
00033 
00034 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00035 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00036 
00037 #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h"
00038 
00039 using namespace std;
00040 
00041 // ROOT
00042 #include "TROOT.h"
00043 #include "TFile.h"
00044 #include "TTree.h"
00045 #include "TBranch.h"
00046 #include "TH1.h"
00047 #include "TH2.h"
00048 class TFile;
00049 
00050 SiStripTrackingRecHitsValid::SiStripTrackingRecHitsValid(const edm::ParameterSet& ps):dbe_(0)
00051 {
00052 
00053   conf_ = ps;
00054 
00055   // slices
00056 
00057   //  myFile = new TFile("slice.root","RECREATE");
00058 
00059   Diff = new TH1F("Diff","Diff",20,0.,1.);
00060   PositionSHx = new TH1F("PositionSHx","PositionSHx",3200,0.,800.);
00061   SecondStrip = new TH1F("SecondStrip","SecondStrip",2,0.,2.);
00062 
00063   ErrxMF = new TH1F("ErrxMF","ErrxMF",80,0.,1.);
00064   ErrxMFvsTrackwidth = new TH2F("ErrxMFvsTrackwidth","ErrxMFvsTrackwidth",12,0.,4.,40,0.,0.5);
00065   ErrxMFvsTrackwidthWClus1 = new TH2F("ErrxMFvsTrackwidthWClus1","ErrxMFvsTrackwidthWClus1",12,0.,4.,40,0.,0.5);
00066   ErrxMFvsTrackwidthWClus2 = new TH2F("ErrxMFvsTrackwidthWClus2","ErrxMFvsTrackwidthWClus2",12,0.,4.,40,0.,0.5);
00067   ErrxMFvsTrackwidthWClus3 = new TH2F("ErrxMFvsTrackwidthWClus3","ErrxMFvsTrackwidthWClus3",12,0.,4.,40,0.,0.5);
00068   ErrxMFvsTrackwidthWClus4 = new TH2F("ErrxMFvsTrackwidthWClus4","ErrxMFvsTrackwidthWClus4",12,0.,4.,40,0.,0.5);
00069 
00070   ResMFvsTrackwidth = new TH2F("ResMFvsTrackwidth","ResMFvsTrackwidth",12,0.,4.,20,-3.,3.);
00071 
00072   ResMFvsTrackwidthWClus1 = new TH2F("ResMFvsTrackwidthWClus1","ResMFvsTrackwidthWClus1",12,0.,4.,100,-1.,1.);
00073   ResMFvsTrackwidthWClus1Wexp1 = new TH2F("ResMFvsTrackwidthWClus1Wexp1","ResMFvsTrackwidthWClus1Wexp1",12,0.,4.,100,-1.,1.);
00074   ResMFvsTrackwidthWClus1Wexp2 = new TH2F("ResMFvsTrackwidthWClus1Wexp2","ResMFvsTrackwidthWClus1Wexp2",12,0.,4.,100,-1.,1.);
00075   ResMFvsTrackwidthWClus1Wexp3 = new TH2F("ResMFvsTrackwidthWClus1Wexp3","ResMFvsTrackwidthWClus1Wexp3",12,0.,4.,100,-1.,1.);
00076   ResMFvsTrackwidthWClus1Wexp4 = new TH2F("ResMFvsTrackwidthWClus1Wexp4","ResMFvsTrackwidthWClus1Wexp4",12,0.,4.,100,-1.,1.);
00077   ResMFvsTrackwidthWClus2 = new TH2F("ResMFvsTrackwidthWClus2","ResMFvsTrackwidthWClus2",12,0.,4.,100,-1.,1.);
00078   ResMFvsTrackwidthWClus2Wexp1 = new TH2F("ResMFvsTrackwidthWClus2Wexp1","ResMFvsTrackwidthWClus2Wexp1",12,0.,4.,100,-1.,1.);
00079   ResMFvsTrackwidthWClus2Wexp2 = new TH2F("ResMFvsTrackwidthWClus2Wexp2","ResMFvsTrackwidthWClus2Wexp2",12,0.,4.,100,-1.,1.);
00080   ResMFvsTrackwidthWClus2Wexp3 = new TH2F("ResMFvsTrackwidthWClus2Wexp3","ResMFvsTrackwidthWClus2Wexp3",12,0.,4.,100,-1.,1.);
00081   ResMFvsTrackwidthWClus2Wexp4 = new TH2F("ResMFvsTrackwidthWClus2Wexp4","ResMFvsTrackwidthWClus2Wexp4",12,0.,4.,100,-1.,1.);
00082   ResMFvsTrackwidthWClus3 = new TH2F("ResMFvsTrackwidthWClus3","ResMFvsTrackwidthWClus3",12,0.,4.,100,-1.,1.);
00083   ResMFvsTrackwidthWClus3Wexp1 = new TH2F("ResMFvsTrackwidthWClus3Wexp1","ResMFvsTrackwidthWClus3Wexp1",12,0.,4.,100,-1.,1.);
00084   ResMFvsTrackwidthWClus3Wexp2 = new TH2F("ResMFvsTrackwidthWClus3Wexp2","ResMFvsTrackwidthWClus3Wexp2",12,0.,4.,100,-1.,1.);
00085   ResMFvsTrackwidthWClus3Wexp3 = new TH2F("ResMFvsTrackwidthWClus3Wexp3","ResMFvsTrackwidthWClus3Wexp3",12,0.,4.,100,-1.,1.);
00086   ResMFvsTrackwidthWClus3Wexp4 = new TH2F("ResMFvsTrackwidthWClus3Wexp4","ResMFvsTrackwidthWClus3Wexp4",12,0.,4.,100,-1.,1.);
00087   ResMFvsTrackwidthWClus4 = new TH2F("ResMFvsTrackwidthWClus4","ResMFvsTrackwidthWClus4",12,0.,4.,100,-1.,1.);
00088   ResMFvsTrackwidthWClus4Wexp1 = new TH2F("ResMFvsTrackwidthWClus4Wexp1","ResMFvsTrackwidthWClus4Wexp1",12,0.,4.,100,-1.,1.);
00089   ResMFvsTrackwidthWClus4Wexp2 = new TH2F("ResMFvsTrackwidthWClus4Wexp2","ResMFvsTrackwidthWClus4Wexp2",12,0.,4.,100,-1.,1.);
00090   ResMFvsTrackwidthWClus4Wexp3 = new TH2F("ResMFvsTrackwidthWClus4Wexp3","ResMFvsTrackwidthWClus4Wexp3",12,0.,4.,100,-1.,1.);
00091   ResMFvsTrackwidthWClus4Wexp4 = new TH2F("ResMFvsTrackwidthWClus4Wexp4","ResMFvsTrackwidthWClus4Wexp4",12,0.,4.,100,-1.,1.);
00092 
00093   ErrxMFvsTrackwidthCategory2 = new TH2F("ErrxMFvsTrackwidthCategory2","ErrxMFvsTrackwidthCategory2",12,0.,4.,20,0.,0.4);
00094   ErrxMFvsTrackwidthCategory3 = new TH2F("ErrxMFvsTrackwidthCategory3","ErrxMFvsTrackwidthCategory3",12,0.,4.,20,0.,0.4);
00095   ErrxMFvsTrackwidthCategory4 = new TH2F("ErrxMFvsTrackwidthCategory4","ErrxMFvsTrackwidthCategory4",12,0.,4.,20,0.,0.4);
00096 
00097   ResMFvsTrackwidthCategory2 = new TH2F("ResMFvsTrackwidthCategory2","ResMFvsTrackwidthCategory2",12,0.,4.,20,-1.,1.);
00098   ResMFvsTrackwidthCategory3 = new TH2F("ResMFvsTrackwidthCategory3","ResMFvsTrackwidthCategory3",12,0.,4.,20,-1.,1.);
00099   ResMFvsTrackwidthCategory4 = new TH2F("ResMFvsTrackwidthCategory4","ResMFvsTrackwidthCategory4",12,0.,4.,20,-1.,1.);
00100 
00101   PullvsTrackwidth = new TH2F("PullvsTrackwidth","PullvsTrackwidth",12,0.,4.,20,-5.,5.);
00102   PullvsClusterwidth = new TH2F("PullvsClusterwidth","PullvsClusterwidth",8,0.5,8.5,20,-5.,5.);
00103   PullvsExpectedwidth = new TH2F("PullvsExpectedwidth","PullvsExpectedwidth",4,0.5,4.5,20,-5.,5.);
00104   PullvsTrackangle = new TH2F("PullvsTrackangle","PullvsTrackangle",10,0.,90.,20,-5.,5.);
00105   PullvsTrackanglebeta = new TH2F("PullvsTrackanglebeta","PullvsTrackanglebeta",9,0.,90.,20,-5.,5.);
00106 
00107   PullvsTrackwidthTIB = new TH2F("PullvsTrackwidthTIB","PullvsTrackwidthTIB",12,0.,4.,20,-5.,5.);
00108   PullvsClusterwidthTIB = new TH2F("PullvsClusterwidthTIB","PullvsClusterwidthTIB",8,0.5,8.5,20,-5.,5.);
00109   PullvsExpectedwidthTIB = new TH2F("PullvsExpectedwidthTIB","PullvsExpectedwidthTIB",4,0.5,4.5,20,-5.,5.);
00110   PullvsTrackangleTIB = new TH2F("PullvsTrackangleTIB","PullvsTrackangleTIB",10,0.,90.,20,-5.,5.);
00111   PullvsTrackanglebetaTIB = new TH2F("PullvsTrackanglebetaTIB","PullvsTrackanglebetaTIB",9,0.,90.,20,-5.,5.);
00112 
00113   PullvsTrackwidthTOB = new TH2F("PullvsTrackwidthTOB","PullvsTrackwidthTOB",12,0.,4.,20,-5.,5.);
00114   PullvsClusterwidthTOB = new TH2F("PullvsClusterwidthTOB","PullvsClusterwidthTOB",8,0.5,8.5,20,-5.,5.);
00115   PullvsExpectedwidthTOB = new TH2F("PullvsExpectedwidthTOB","PullvsExpectedwidthTOB",4,0.5,4.5,20,-5.,5.);
00116   PullvsTrackangleTOB = new TH2F("PullvsTrackangleTOB","PullvsTrackangleTOB",10,0.,90.,20,-5.,5.);
00117   PullvsTrackanglebetaTOB = new TH2F("PullvsTrackanglebetaTOB","PullvsTrackanglebetaTOB",9,0.,90.,20,-5.,5.);
00118 
00119   PullvsTrackwidthTID = new TH2F("PullvsTrackwidthTID","PullvsTrackwidthTID",12,0.,4.,20,-5.,5.);
00120   PullvsClusterwidthTID = new TH2F("PullvsClusterwidthTID","PullvsClusterwidthTID",8,0.5,8.5,20,-5.,5.);
00121   PullvsExpectedwidthTID = new TH2F("PullvsExpectedwidthTID","PullvsExpectedwidthTID",4,0.5,4.5,20,-5.,5.);
00122   PullvsTrackangleTID = new TH2F("PullvsTrackangleTID","PullvsTrackangleTID",10,0.,90.,20,-5.,5.);
00123   PullvsTrackanglebetaTID = new TH2F("PullvsTrackanglebetaTID","PullvsTrackanglebetaTID",9,0.,90.,20,-5.,5.);
00124 
00125   PullvsTrackwidthTEC = new TH2F("PullvsTrackwidthTEC","PullvsTrackwidthTEC",12,0.,4.,20,-5.,5.);
00126   PullvsClusterwidthTEC = new TH2F("PullvsClusterwidthTEC","PullvsClusterwidthTEC",8,0.5,8.5,20,-5.,5.);
00127   PullvsExpectedwidthTEC = new TH2F("PullvsExpectedwidthTEC","PullvsExpectedwidthTEC",4,0.5,4.5,20,-5.,5.);
00128   PullvsTrackangleTEC = new TH2F("PullvsTrackangleTEC","PullvsTrackangleTEC",10,0.,90.,20,-5.,5.);
00129   PullvsTrackanglebetaTEC = new TH2F("PullvsTrackanglebetaTEC","PullvsTrackanglebetaTEC",9,0.,90.,20,-5.,5.);
00130 
00131   //Read config file
00132   //MTCCtrack_ = ps.getParameter<bool>("MTCCtrack");
00133   outputFile_ = ps.getUntrackedParameter<string>("outputFile", "striptrackingrechitshisto.root");
00134   //src_ = ps.getUntrackedParameter<std::string>( "src" );
00135   //builderName_ = ps.getParameter<std::string>("TTRHBuilder");   
00136 
00137   // Book histograms
00138   dbe_ = edm::Service<DQMStore>().operator->();
00139   //  dbe_->showDirStructure();
00140 
00141   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/ALL");
00142 
00143   Char_t histo[200];
00144 
00145   sprintf(histo,"Errx_LF");
00146   meErrxLF = dbe_->book1D(histo,"RecHit err(x) Local Frame coord.",100,0,0.005);  
00147   //  const float Entries1 = meErrxLF->getEntries();
00148 
00149   sprintf(histo,"Errx_MF");
00150   meErrxMF = dbe_->book1D(histo,"RecHit err(x) Meas. Frame coord.",100,0,0.5);  
00151 
00152   sprintf(histo,"Res_LF");
00153   meResLF = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);  
00154 
00155   sprintf(histo,"Res_MF");
00156   meResMF = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);  
00157 
00158   sprintf(histo,"Pull_LF");
00159   mePullLF = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00160 
00161   sprintf(histo,"Pull_MF");
00162   mePullMF = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00163 
00164   sprintf(histo,"Category");
00165   meCategory = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00166 
00167   sprintf(histo,"Trackwidth");
00168   meTrackwidth = dbe_->book1D(histo,"Track width",100,0.,4.);  
00169 
00170   sprintf(histo,"Expectedwidth");
00171   meExpectedwidth = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00172 
00173   sprintf(histo,"Clusterwidth");
00174   meClusterwidth = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00175 
00176   sprintf(histo,"Trackanglealpha");
00177   meTrackanglealpha = dbe_->book1D(histo,"Track angle alpha",100,-100.,100.);  
00178 
00179   sprintf(histo,"Trackanglebeta");
00180   meTrackanglebeta = dbe_->book1D(histo,"Track angle beta",100,-100.,100.);  
00181 
00182   sprintf(histo,"ErrxMFTrackwidthProfile_WClus1");
00183   meErrxMFTrackwidthProfileWClus1 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00184 
00185   sprintf(histo,"ErrxMFTrackwidthProfile_WClus2");
00186   meErrxMFTrackwidthProfileWClus2 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"");
00187 
00188   sprintf(histo,"ErrxMFTrackwidthProfile_WClus3");
00189   meErrxMFTrackwidthProfileWClus3 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00190 
00191   sprintf(histo,"ErrxMFTrackwidthProfile_WClus4");
00192   meErrxMFTrackwidthProfileWClus4 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00193 
00194   sprintf(histo,"ResMFTrackwidthProfile_WClus1");
00195   meResMFTrackwidthProfileWClus1 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00196 
00197   sprintf(histo,"ResMFTrackwidthProfile_WClus2");
00198   meResMFTrackwidthProfileWClus2 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"");
00199   sprintf(histo,"ResMFTrackwidthProfile_WClus21");
00200   meResMFTrackwidthProfileWClus21 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -2.,2.,"");
00201   sprintf(histo,"ResMFTrackwidthProfile_WClus22");
00202   meResMFTrackwidthProfileWClus22 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -5.,5.,"");
00203   sprintf(histo,"ResMFTrackwidthProfile_WClus23");
00204   meResMFTrackwidthProfileWClus23 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -0.5,0.5,"");
00205   //sprintf(histo,"ResMFTrackwidthProfile_WClus2");
00206   //meResMFTrackwidthProfileWClus22 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4., 0.,2.,"s");
00207 
00208   sprintf(histo,"ResMFTrackwidthProfile_WClus3");
00209   meResMFTrackwidthProfileWClus3 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00210 
00211   sprintf(histo,"ResMFTrackwidthProfile_WClus4");
00212   meResMFTrackwidthProfileWClus4 = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00213 
00214   sprintf(histo,"ErrxMFTrackwidthProfile");
00215   meErrxMFTrackwidthProfile = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, 0.,2.,"s");
00216 
00217   sprintf(histo,"ErrxMFTrackwidthProfile_Category1");
00218   meErrxMFTrackwidthProfileCategory1 = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12, 0., 4.,100, -2.,2.,"s");
00219   sprintf(histo,"ErrxMFTrackwidthProfile_Category2");
00220   meErrxMFTrackwidthProfileCategory2 = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12, 0., 4.,100, -2.,2.,"s");
00221 
00222   sprintf(histo,"ErrxMFTrackwidthProfile_Category3");
00223   meErrxMFTrackwidthProfileCategory3 = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12, 0., 4.,100, -2.,2.,"s");
00224 
00225   sprintf(histo,"ErrxMFTrackwidthProfile_Category4");
00226   meErrxMFTrackwidthProfileCategory4 = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12, 0., 4.,100, -2.,2.,"s");
00227 
00228   sprintf(histo,"ErrxMFClusterwidthProfile_Category1");
00229    meErrxMFClusterwidthProfileCategory1= dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00230 
00231   sprintf(histo,"ErrxMFAngleProfile");
00232   meErrxMFAngleProfile = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 60.,100, 0.,2.,"s");
00233 
00234   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/TIB");
00235   //one histo per Layer rphi hits
00236   for(int i = 0 ;i<4 ; i++) {
00237     Char_t histo[200];
00238     sprintf(histo,"Nstp_rphi_layer%dtib",i+1);
00239     meNstpRphiTIB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00240     sprintf(histo,"Adc_rphi_layer%dtib",i+1);
00241     meAdcRphiTIB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00242     sprintf(histo,"Posx_rphi_layer%dtib",i+1);
00243     mePosxRphiTIB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00244 
00245     sprintf(histo,"Errx_LF_rphi_layer%dtib",i+1);
00246     meErrxLFRphiTIB[i] = dbe_->book1D(histo,"RecHit err(x) Local Frame coord.",100,0,0.005);  
00247     sprintf(histo,"Errx_MF_rphi_layer%dtib",i+1);
00248     meErrxMFRphiTIB[i] = dbe_->book1D(histo,"RecHit err(x) Meas. Frame coord.",100,0,0.5);  
00249 
00250     sprintf(histo,"Res_LF_rphi_layer%dtib",i+1);
00251     meResLFRphiTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);  
00252     sprintf(histo,"Res_MF_rphi_layer%dtib",i+1);
00253     meResMFRphiTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);  
00254 
00255     sprintf(histo,"Pull_LF_rphi_layer%dtib",i+1);
00256     mePullLFRphiTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00257     sprintf(histo,"Pull_MF_rphi_layer%dtib",i+1);
00258     mePullMFRphiTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00259 
00260     sprintf(histo,"Trackangle_rphi_layer%dtib",i+1);
00261     meTrackangleRphiTIB[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);  
00262 
00263     sprintf(histo,"Trackanglebeta_rphi_layer%dtib",i+1);
00264     meTrackanglebetaRphiTIB[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);  
00265 
00266     sprintf(histo,"Trackangle2_rphi_layer%dtib",i+1);
00267     meTrackangle2RphiTIB[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);  
00268 
00269     sprintf(histo,"PullTrackangleProfile_rphi_layer%dtib",i+1);
00270     mePullTrackangleProfileRphiTIB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100, -2.,2.,"s");
00271 
00272     sprintf(histo,"Trackwidth_rphi_layer%dtib",i+1);
00273     meTrackwidthRphiTIB[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00274 
00275     sprintf(histo,"Expectedwidth_rphi_layer%dtib",i+1);
00276     meExpectedwidthRphiTIB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00277 
00278     sprintf(histo,"Clusterwidth_rphi_layer%dtib",i+1);
00279     meClusterwidthRphiTIB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00280 
00281     sprintf(histo,"Category_rphi_layer%dtib",i+1);
00282     meCategoryRphiTIB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00283 
00284     sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtib",i+1);
00285     mePullTrackwidthProfileRphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00286 
00287     sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtib",i+1);
00288     mePullTrackwidthProfileCategory1RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00289 
00290     sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtib",i+1);
00291     mePullTrackwidthProfileCategory2RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00292     
00293     sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtib",i+1);
00294     mePullTrackwidthProfileCategory3RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00295     
00296     sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtib",i+1);
00297     mePullTrackwidthProfileCategory4RphiTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00298     
00299     sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtib",i+1);
00300     meErrxMFTrackwidthProfileRphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12, 0., 4.,100, -2.,2.,"s");
00301 
00302 
00303     sprintf(histo,"ErrxMFTrackwidthProfile_WClus1_rphi_layer%dtib",i+1);
00304     meErrxMFTrackwidthProfileWclus1RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00305 
00306     sprintf(histo,"ErrxMFTrackwidthProfile_WClus2_rphi_layer%dtib",i+1);
00307     meErrxMFTrackwidthProfileWclus2RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00308 
00309     sprintf(histo,"ErrxMFTrackwidthProfile_WClus3_rphi_layer%dtib",i+1);
00310     meErrxMFTrackwidthProfileWclus3RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00311 
00312     sprintf(histo,"ErrxMFTrackwidthProfile_WClus4_rphi_layer%dtib",i+1);
00313     meErrxMFTrackwidthProfileWclus4RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00314 
00315     sprintf(histo,"ResMFTrackwidthProfile_WClus1_rphi_layer%dtib",i+1);
00316     meResMFTrackwidthProfileWclus1RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00317     sprintf(histo,"ResMFTrackwidthProfile_WClus2_rphi_layer%dtib",i+1);
00318     meResMFTrackwidthProfileWclus2RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00319 
00320     sprintf(histo,"ResMFTrackwidthProfile_WClus3_rphi_layer%dtib",i+1);
00321     meResMFTrackwidthProfileWclus3RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00322 
00323     sprintf(histo,"ResMFTrackwidthProfile_WClus4_rphi_layer%dtib",i+1);
00324     meResMFTrackwidthProfileWclus4RphiTIB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00325 
00326 
00327 
00328     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtib",i+1);
00329     meErrxMFTrackwidthProfileCategory1RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12, 0., 4.,100, -2.,2.,"s");
00330 
00331     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtib",i+1);
00332     meErrxMFTrackwidthProfileCategory2RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12, 0., 4.,100, -2.,2.,"s");
00333 
00334     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtib",i+1);
00335     meErrxMFTrackwidthProfileCategory3RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12, 0., 4.,100, -2.,2.,"s");
00336 
00337     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtib",i+1);
00338     meErrxMFTrackwidthProfileCategory4RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12, 0., 4.,100, -2.,2.,"s");
00339 
00340     sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtib",i+1);
00341     meErrxMFAngleProfileRphiTIB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00342 
00343     sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtib",i+1);
00344     meErrxMFClusterwidthProfileCategory1RphiTIB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00345     
00346   }
00347 
00348   //one histo per Layer stereo and matched hits
00349   for(int i = 0 ;i<2 ; i++) {
00350     Char_t histo[200];
00351     sprintf(histo,"Nstp_sas_layer%dtib",i+1);
00352     meNstpSasTIB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00353     sprintf(histo,"Adc_sas_layer%dtib",i+1);
00354     meAdcSasTIB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00355     sprintf(histo,"Posx_sas_layer%dtib",i+1);
00356     mePosxSasTIB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00357 
00358     sprintf(histo,"Errx_LF_sas_layer%dtib",i+1);
00359     meErrxLFSasTIB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.005);  
00360     sprintf(histo,"Errx_MF_sas_layer%dtib",i+1);
00361     meErrxMFSasTIB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);  
00362 
00363     sprintf(histo,"Res_LF_sas_layer%dtib",i+1);
00364     meResLFSasTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);  
00365     sprintf(histo,"Res_MF_sas_layer%dtib",i+1);
00366     meResMFSasTIB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);  
00367 
00368     sprintf(histo,"Pull_LF_sas_layer%dtib",i+1);
00369     mePullLFSasTIB[i] = dbe_->book1D(histo,"Pull",100,-4.,4.);  
00370     sprintf(histo,"Pull_MF_sas_layer%dtib",i+1);
00371     mePullMFSasTIB[i] = dbe_->book1D(histo,"Pull",100,-4.,4.);  
00372 
00373     sprintf(histo,"Trackangle_sas_layer%dtib",i+1);
00374     meTrackangleSasTIB[i] = dbe_->book1D(histo,"Track angle",100,-40.,40.);  
00375 
00376     sprintf(histo,"Trackanglebeta_sas_layer%dtib",i+1);
00377     meTrackanglebetaSasTIB[i] = dbe_->book1D(histo,"Track angle beta",100,-40.,40.);  
00378 
00379     sprintf(histo,"PullTrackangleProfile_sas_layer%dtib",i+1);
00380     mePullTrackangleProfileSasTIB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile",  100, -40., 40.,100,-4.,4.,"s");
00381 
00382     sprintf(histo,"Trackwidth_sas_layer%dtib",i+1);
00383     meTrackwidthSasTIB[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00384 
00385     sprintf(histo,"Expectedwidth_sas_layer%dtib",i+1);
00386     meExpectedwidthSasTIB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00387 
00388     sprintf(histo,"Clusterwidth_sas_layer%dtib",i+1);
00389     meClusterwidthSasTIB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00390 
00391     sprintf(histo,"Category_sas_layer%dtib",i+1);
00392     meCategorySasTIB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00393 
00394     sprintf(histo,"PullTrackwidthProfile_sas_layer%dtib",i+1);
00395     mePullTrackwidthProfileSasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00396 
00397     sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtib",i+1);
00398     mePullTrackwidthProfileCategory1SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00399 
00400     sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtib",i+1);
00401     mePullTrackwidthProfileCategory2SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00402     
00403     sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtib",i+1);
00404     mePullTrackwidthProfileCategory3SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00405     
00406     sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtib",i+1);
00407     mePullTrackwidthProfileCategory4SasTIB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00408 
00409     sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtib",i+1);
00410     meErrxMFTrackwidthProfileSasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00411 
00412     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtib",i+1);
00413     meErrxMFTrackwidthProfileCategory1SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00414     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtib",i+1);
00415     meErrxMFTrackwidthProfileCategory2SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00416     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtib",i+1);
00417     meErrxMFTrackwidthProfileCategory3SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00418     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtib",i+1);
00419     meErrxMFTrackwidthProfileCategory4SasTIB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00420 
00421     sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtib",i+1);
00422     meErrxMFAngleProfileSasTIB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00423 
00424     sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtib",i+1);
00425     meErrxMFClusterwidthProfileCategory1SasTIB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00426     
00427 
00428 
00429     sprintf(histo,"Posx_matched_layer%dtib",i+1);
00430     mePosxMatchedTIB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);  
00431     sprintf(histo,"Posy_matched_layer%dtib",i+1);
00432     mePosyMatchedTIB[i] = dbe_->book1D(histo,"RecHit y coord.",100,-6.0, +6.0);  
00433     sprintf(histo,"Errx_matched_layer%dtib",i+1);
00434     meErrxMatchedTIB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.05);  
00435     sprintf(histo,"Erry_matched_layer%dtib",i+1);
00436     meErryMatchedTIB[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.05);  
00437     sprintf(histo,"Resx_matched_layer%dtib",i+1);
00438     meResxMatchedTIB[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.02, +0.02);  
00439     sprintf(histo,"Resy_matched_layer%dtib",i+1);
00440     meResyMatchedTIB[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);  
00441     sprintf(histo,"Pullx_matched_layer%dtib",i+1);
00442     mePullxMatchedTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00443     sprintf(histo,"Pully_matched_layer%dtib",i+1);
00444     mePullyMatchedTIB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00445   }
00446 
00447   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/TOB");
00448   //one histo per Layer rphi hits
00449   for(int i = 0 ;i<6 ; i++) {
00450     Char_t histo[200];
00451     sprintf(histo,"Nstp_rphi_layer%dtob",i+1);
00452     meNstpRphiTOB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00453     sprintf(histo,"Adc_rphi_layer%dtob",i+1);
00454     meAdcRphiTOB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00455     sprintf(histo,"Posx_rphi_layer%dtob",i+1);
00456     mePosxRphiTOB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00457 
00458     sprintf(histo,"Errx_LF_rphi_layer%dtob",i+1);
00459     meErrxLFRphiTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.01);  
00460     sprintf(histo,"Errx_MF_rphi_layer%dtob",i+1);
00461     meErrxMFRphiTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);  
00462 
00463     sprintf(histo,"Res_LF_rphi_layer%dtob",i+1);
00464     meResLFRphiTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);  
00465     sprintf(histo,"Res_MF_rphi_layer%dtob",i+1);
00466     meResMFRphiTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);  
00467 
00468     sprintf(histo,"Pull_LF_rphi_layer%dtob",i+1);
00469     mePullLFRphiTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00470     sprintf(histo,"Pull_MF_rphi_layer%dtob",i+1);
00471     mePullMFRphiTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00472 
00473     sprintf(histo,"Trackangle_rphi_layer%dtob",i+1);
00474     meTrackangleRphiTOB[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);  
00475 
00476     sprintf(histo,"Trackanglebeta_rphi_layer%dtob",i+1);
00477     meTrackanglebetaRphiTOB[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);  
00478 
00479     sprintf(histo,"PullTrackangleProfile_rphi_layer%dtob",i+1);
00480     mePullTrackangleProfileRphiTOB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile",  100, -20., 20.,100,-5.,5.,"s");
00481 
00482     sprintf(histo,"Trackwidth_rphi_layer%dtob",i+1);
00483     meTrackwidthRphiTOB[i] = dbe_->book1D(histo,"Track width",100,0.,4.);  
00484 
00485     sprintf(histo,"Expectedwidth_rphi_layer%dtob",i+1);
00486     meExpectedwidthRphiTOB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00487 
00488     sprintf(histo,"Clusterwidth_rphi_layer%dtob",i+1);
00489     meClusterwidthRphiTOB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00490 
00491     sprintf(histo,"Category_rphi_layer%dtob",i+1);
00492     meCategoryRphiTOB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00493 
00494     sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtob",i+1);
00495     mePullTrackwidthProfileRphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00496 
00497     sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtob",i+1);
00498     mePullTrackwidthProfileCategory1RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00499 
00500     sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtob",i+1);
00501     mePullTrackwidthProfileCategory2RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00502     
00503     sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtob",i+1);
00504     mePullTrackwidthProfileCategory3RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00505     
00506     sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtob",i+1);
00507     mePullTrackwidthProfileCategory4RphiTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00508 
00509     sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtob",i+1);
00510     meErrxMFTrackwidthProfileRphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00511 
00512     sprintf(histo,"ErrxMFTrackwidthProfile_WClus1_rphi_layer%dtob",i+1);
00513     meErrxMFTrackwidthProfileWclus1RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00514 
00515     sprintf(histo,"ErrxMFTrackwidthProfile_WClus2_rphi_layer%dtob",i+1);
00516     meErrxMFTrackwidthProfileWclus2RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00517 
00518     sprintf(histo,"ErrxMFTrackwidthProfile_WClus3_rphi_layer%dtob",i+1);
00519     meErrxMFTrackwidthProfileWclus3RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00520 
00521     sprintf(histo,"ErrxMFTrackwidthProfile_WClus4_rphi_layer%dtob",i+1);
00522     meErrxMFTrackwidthProfileWclus4RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00523 
00524     sprintf(histo,"ResMFTrackwidthProfile_WClus1_rphi_layer%dtob",i+1);
00525     meResMFTrackwidthProfileWclus1RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00526     sprintf(histo,"ResMFTrackwidthProfile_WClus2_rphi_layer%dtob",i+1);
00527     meResMFTrackwidthProfileWclus2RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00528 
00529     sprintf(histo,"ResMFTrackwidthProfile_WClus3_rphi_layer%dtob",i+1);
00530     meResMFTrackwidthProfileWclus3RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00531 
00532     sprintf(histo,"ResMFTrackwidthProfile_WClus4_rphi_layer%dtob",i+1);
00533     meResMFTrackwidthProfileWclus4RphiTOB[i] = dbe_->bookProfile(histo,"Residue Track width Profile Wclus1", 12, 0., 4.,100, -2.,2.,"s");
00534 
00535 
00536 
00537     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtob",i+1);
00538     meErrxMFTrackwidthProfileCategory1RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00539 
00540     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtob",i+1);
00541     meErrxMFTrackwidthProfileCategory2RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00542 
00543     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtob",i+1);
00544     meErrxMFTrackwidthProfileCategory3RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00545 
00546     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtob",i+1);
00547     meErrxMFTrackwidthProfileCategory4RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00548 
00549     sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtob",i+1);
00550     meErrxMFAngleProfileRphiTOB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00551 
00552     sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtob",i+1);
00553     meErrxMFClusterwidthProfileCategory1RphiTOB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00554     
00555   }
00556 
00557   //one histo per Layer stereo and matched hits
00558   for(int i = 0 ;i<2 ; i++) {
00559     Char_t histo[200];
00560     sprintf(histo,"Nstp_sas_layer%dtob",i+1);
00561     meNstpSasTOB[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00562     sprintf(histo,"Adc_sas_layer%dtob",i+1);
00563     meAdcSasTOB[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00564     sprintf(histo,"Posx_sas_layer%dtob",i+1);
00565     mePosxSasTOB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00566 
00567     sprintf(histo,"Errx_LF_sas_layer%dtob",i+1);
00568     meErrxLFSasTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.01);  
00569     sprintf(histo,"Errx_MF_sas_layer%dtob",i+1);
00570     meErrxMFSasTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);  
00571 
00572     sprintf(histo,"Res_LF_sas_layer%dtob",i+1);
00573     meResLFSasTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.02,+0.02);  
00574     sprintf(histo,"Res_MF_sas_layer%dtob",i+1);
00575     meResMFSasTOB[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);  
00576 
00577     sprintf(histo,"Pull_LF_sas_layer%dtob",i+1);
00578     mePullLFSasTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00579     sprintf(histo,"Pull_MF_sas_layer%dtob",i+1);
00580     mePullMFSasTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00581 
00582     sprintf(histo,"Trackangle_sas_layer%dtob",i+1);
00583     meTrackangleSasTOB[i] = dbe_->book1D(histo,"Track angle",100,-25.,25.);  
00584 
00585     sprintf(histo,"Trackanglebeta_sas_layer%dtob",i+1);
00586     meTrackanglebetaSasTOB[i] = dbe_->book1D(histo,"Track angle beta",100,-25.,25.);  
00587 
00588     sprintf(histo,"PullTrackangleProfile_sas_layer%dtob",i+1);
00589     mePullTrackangleProfileSasTOB[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -25., 25. ,100 , -5., 5.,"s");
00590 
00591     sprintf(histo,"Trackwidth_sas_layer%dtob",i+1);
00592     meTrackwidthSasTOB[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00593 
00594     sprintf(histo,"Expectedwidth_sas_layer%dtob",i+1);
00595     meExpectedwidthSasTOB[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00596 
00597     sprintf(histo,"Clusterwidth_sas_layer%dtob",i+1);
00598     meClusterwidthSasTOB[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00599 
00600     sprintf(histo,"Category_sas_layer%dtob",i+1);
00601     meCategorySasTOB[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00602 
00603     sprintf(histo,"PullTrackwidthProfile_sas_layer%dtob",i+1);
00604     mePullTrackwidthProfileSasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00605 
00606     sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtob",i+1);
00607     mePullTrackwidthProfileCategory1SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00608 
00609     sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtob",i+1);
00610     mePullTrackwidthProfileCategory2SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00611     
00612     sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtob",i+1);
00613     mePullTrackwidthProfileCategory3SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00614     
00615     sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtob",i+1);
00616     mePullTrackwidthProfileCategory4SasTOB[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00617 
00618     sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtob",i+1);
00619     meErrxMFTrackwidthProfileSasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00620 
00621     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtob",i+1);
00622     meErrxMFTrackwidthProfileCategory1SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00623     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtob",i+1);
00624     meErrxMFTrackwidthProfileCategory2SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00625     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtob",i+1);
00626     meErrxMFTrackwidthProfileCategory3SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00627     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtob",i+1);
00628     meErrxMFTrackwidthProfileCategory4SasTOB[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00629 
00630     sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtob",i+1);
00631     meErrxMFAngleProfileSasTOB[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00632 
00633      sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtob",i+1);
00634     meErrxMFClusterwidthProfileCategory1SasTOB[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00635     
00636    sprintf(histo,"Posx_matched_layer%dtob",i+1);
00637     mePosxMatchedTOB[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);  
00638     sprintf(histo,"Posy_matched_layer%dtob",i+1);
00639     mePosyMatchedTOB[i] = dbe_->book1D(histo,"RecHit y coord.",100,-6.0, +6.0);  
00640     sprintf(histo,"Errx_matched_layer%dtob",i+1);
00641     meErrxMatchedTOB[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.05);  
00642     sprintf(histo,"Erry_matched_layer%dtob",i+1);
00643     meErryMatchedTOB[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.05);  
00644     sprintf(histo,"Resx_matched_layer%dtob",i+1);
00645     meResxMatchedTOB[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.02, +0.02);  
00646     sprintf(histo,"Resy_matched_layer%dtob",i+1);
00647     meResyMatchedTOB[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);  
00648     sprintf(histo,"Pullx_matched_layer%dtob",i+1);
00649     mePullxMatchedTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00650     sprintf(histo,"Pully_matched_layer%dtob",i+1);
00651     mePullyMatchedTOB[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00652   }
00653 
00654   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/TID");
00655   //one histo per Ring rphi hits: 3 rings, 6 disks, 2 inner rings are glued 
00656   for(int i = 0 ;i<3 ; i++) {
00657     Char_t histo[200];
00658     sprintf(histo,"Nstp_rphi_layer%dtid",i+1);
00659     meNstpRphiTID[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00660     sprintf(histo,"Adc_rphi_layer%dtid",i+1);
00661     meAdcRphiTID[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00662     sprintf(histo,"Posx_rphi_layer%dtid",i+1);
00663     mePosxRphiTID[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00664     sprintf(histo,"Errx_LF_rphi_layer%dtid",i+1);
00665     meErrxLFRphiTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);  
00666     sprintf(histo,"Errx_MF_rphi_layer%dtid",i+1);
00667     meErrxMFRphiTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);  
00668     sprintf(histo,"Res_LF_rphi_layer%dtid",i+1);
00669     meResLFRphiTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);  
00670     sprintf(histo,"Res_MF_rphi_layer%dtid",i+1);
00671     meResMFRphiTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);  
00672     sprintf(histo,"Pull_LF_rphi_layer%dtid",i+1);
00673     mePullLFRphiTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00674     sprintf(histo,"Pull_MF_rphi_layer%dtid",i+1);
00675     mePullMFRphiTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00676     sprintf(histo,"Trackangle_rphi_layer%dtid",i+1);
00677     meTrackangleRphiTID[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);  
00678 
00679     sprintf(histo,"Trackanglebeta_rphi_layer%dtid",i+1);
00680     meTrackanglebetaRphiTID[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);  
00681 
00682     sprintf(histo,"PullTrackangleProfile_rphi_layer%dtid",i+1);
00683     mePullTrackangleProfileRphiTID[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100, -5., 5.,"s");
00684 
00685     sprintf(histo,"Trackwidth_rphi_layer%dtid",i+1);
00686     meTrackwidthRphiTID[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00687 
00688     sprintf(histo,"Expectedwidth_rphi_layer%dtid",i+1);
00689     meExpectedwidthRphiTID[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00690 
00691     sprintf(histo,"Clusterwidth_rphi_layer%dtid",i+1);
00692     meClusterwidthRphiTID[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00693 
00694     sprintf(histo,"Category_rphi_layer%dtid",i+1);
00695     meCategoryRphiTID[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00696 
00697     sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtid",i+1);
00698     mePullTrackwidthProfileRphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00699 
00700     sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtid",i+1);
00701     mePullTrackwidthProfileCategory1RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00702 
00703     sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtid",i+1);
00704     mePullTrackwidthProfileCategory2RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00705     
00706     sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtid",i+1);
00707     mePullTrackwidthProfileCategory3RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00708     
00709     sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtid",i+1);
00710     mePullTrackwidthProfileCategory4RphiTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00711 
00712     sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtid",i+1);
00713     meErrxMFTrackwidthProfileRphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00714 
00715     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtid",i+1);
00716     meErrxMFTrackwidthProfileCategory1RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00717     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtid",i+1);
00718     meErrxMFTrackwidthProfileCategory2RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00719     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtid",i+1);
00720     meErrxMFTrackwidthProfileCategory3RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00721     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtid",i+1);
00722     meErrxMFTrackwidthProfileCategory4RphiTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00723 
00724     sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtid",i+1);
00725     meErrxMFAngleProfileRphiTID[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00726 
00727     sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtid",i+1);
00728     meErrxMFClusterwidthProfileCategory1RphiTID[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00729     
00730   }
00731 
00732   //one histo per Ring stereo and matched hits
00733   for(int i = 0 ;i<2 ; i++) {
00734     Char_t histo[200];
00735     sprintf(histo,"Nstp_sas_layer%dtid",i+1);
00736     meNstpSasTID[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00737     sprintf(histo,"Adc_sas_layer%dtid",i+1);
00738     meAdcSasTID[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00739     sprintf(histo,"Posx_sas_layer%dtid",i+1);
00740     mePosxSasTID[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00741     sprintf(histo,"Errx_LF_sas_layer%dtid",i+1);
00742     meErrxLFSasTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);  
00743     sprintf(histo,"Errx_MF_sas_layer%dtid",i+1);
00744     meErrxMFSasTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);  
00745     sprintf(histo,"Res_LF_sas_layer%dtid",i+1);
00746     meResLFSasTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);  
00747     sprintf(histo,"Res_MF_sas_layer%dtid",i+1);
00748     meResMFSasTID[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);  
00749     sprintf(histo,"Pull_LF_sas_layer%dtid",i+1);
00750     mePullLFSasTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00751     sprintf(histo,"Pull_MF_sas_layer%dtid",i+1);
00752     mePullMFSasTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00753     sprintf(histo,"Trackangle_sas_layer%dtid",i+1);
00754     meTrackangleSasTID[i] = dbe_->book1D(histo,"Track angle",100,-20.,20.);  
00755    sprintf(histo,"Trackanglebeta_sas_layer%dtid",i+1);
00756     meTrackanglebetaSasTID[i] = dbe_->book1D(histo,"Track angle beta",100,-20.,20.);  
00757 
00758     sprintf(histo,"PullTrackangleProfile_sas_layer%dtid",i+1);
00759     mePullTrackangleProfileSasTID[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -20., 20.,100, -5., 5.,"s");
00760 
00761     sprintf(histo,"Trackwidth_sas_layer%dtid",i+1);
00762     meTrackwidthSasTID[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00763 
00764     sprintf(histo,"Expectedwidth_sas_layer%dtid",i+1);
00765     meExpectedwidthSasTID[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00766 
00767     sprintf(histo,"Clusterwidth_sas_layer%dtid",i+1);
00768     meClusterwidthSasTID[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00769 
00770     sprintf(histo,"Category_sas_layer%dtid",i+1);
00771     meCategorySasTID[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00772 
00773     sprintf(histo,"PullTrackwidthProfile_sas_layer%dtid",i+1);
00774     mePullTrackwidthProfileSasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00775 
00776     sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtid",i+1);
00777     mePullTrackwidthProfileCategory1SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00778 
00779     sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtid",i+1);
00780     mePullTrackwidthProfileCategory2SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00781     
00782     sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtid",i+1);
00783     mePullTrackwidthProfileCategory3SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00784     
00785     sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtid",i+1);
00786     mePullTrackwidthProfileCategory4SasTID[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00787 
00788     sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtid",i+1);
00789     meErrxMFTrackwidthProfileSasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00790 
00791     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtid",i+1);
00792     meErrxMFTrackwidthProfileCategory1SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00793     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtid",i+1);
00794     meErrxMFTrackwidthProfileCategory2SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00795     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtid",i+1);
00796     meErrxMFTrackwidthProfileCategory3SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00797     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtid",i+1);
00798     meErrxMFTrackwidthProfileCategory4SasTID[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00799 
00800     sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtid",i+1);
00801     meErrxMFAngleProfileSasTID[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00802 
00803      sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtid",i+1);
00804     meErrxMFClusterwidthProfileCategory1SasTID[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00805     
00806    sprintf(histo,"Posx_matched_layer%dtid",i+1);
00807     mePosxMatchedTID[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);  
00808     sprintf(histo,"Posy_matched_layer%dtid",i+1);
00809     mePosyMatchedTID[i] = dbe_->book1D(histo,"RecHit y coord.",100,-6.0, +6.0);  
00810     sprintf(histo,"Errx_matched_layer%dtid",i+1);
00811     meErrxMatchedTID[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.02);  
00812     sprintf(histo,"Erry_matched_layer%dtid",i+1);
00813     meErryMatchedTID[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.1);  
00814     sprintf(histo,"Resx_matched_layer%dtid",i+1);
00815     meResxMatchedTID[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.2, +0.2);  
00816     sprintf(histo,"Resy_matched_layer%dtid",i+1);
00817     meResyMatchedTID[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);  
00818     sprintf(histo,"Pullx_matched_layer%dtid",i+1);
00819     mePullxMatchedTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00820     sprintf(histo,"Pully_matched_layer%dtid",i+1);
00821     mePullyMatchedTID[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00822   }
00823 
00824   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/TEC");
00825   //one histo per Ring rphi hits: 7 rings, 18 disks. Innermost 3 rings are same as TID above.  
00826   for(int i = 0 ;i<7 ; i++) {
00827     Char_t histo[200];
00828     sprintf(histo,"Nstp_rphi_layer%dtec",i+1);
00829     meNstpRphiTEC[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00830     sprintf(histo,"Adc_rphi_layer%dtec",i+1);
00831     meAdcRphiTEC[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00832     sprintf(histo,"Posx_rphi_layer%dtec",i+1);
00833     mePosxRphiTEC[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00834 
00835     sprintf(histo,"Errx_LF_rphi_layer%dtec",i+1);
00836     meErrxLFRphiTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);  
00837     sprintf(histo,"Errx_MF_rphi_layer%dtec",i+1);
00838     meErrxMFRphiTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0,0.5);  
00839 
00840     sprintf(histo,"Res_LF_rphi_layer%dtec",i+1);
00841     meResLFRphiTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);  
00842     sprintf(histo,"Res_MF_rphi_layer%dtec",i+1);
00843     meResMFRphiTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,2);  
00844 
00845     sprintf(histo,"Pull_LF_rphi_layer%dtec",i+1);
00846     mePullLFRphiTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00847     sprintf(histo,"Pull_MF_rphi_layer%dtec",i+1);
00848     mePullMFRphiTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00849 
00850     sprintf(histo,"Trackangle_rphi_layer%dtec",i+1);
00851     meTrackangleRphiTEC[i] = dbe_->book1D(histo,"Track angle",100,-10.,10.);  
00852 
00853     sprintf(histo,"Trackanglebeta_rphi_layer%dtec",i+1);
00854     meTrackanglebetaRphiTEC[i] = dbe_->book1D(histo,"Track angle beta",100,-10.,10.);  
00855 
00856     sprintf(histo,"PullTrackangleProfile_rphi_layer%dtec",i+1);
00857     mePullTrackangleProfileRphiTEC[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -10., 10.,100, -5., 5.,"s");
00858 
00859     sprintf(histo,"Trackwidth_rphi_layer%dtec",i+1);
00860     meTrackwidthRphiTEC[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00861 
00862     sprintf(histo,"Expectedwidth_rphi_layer%dtec",i+1);
00863     meExpectedwidthRphiTEC[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00864 
00865     sprintf(histo,"Clusterwidth_rphi_layer%dtec",i+1);
00866     meClusterwidthRphiTEC[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00867 
00868     sprintf(histo,"Category_rphi_layer%dtec",i+1);
00869     meCategoryRphiTEC[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00870 
00871     sprintf(histo,"PullTrackwidthProfile_rphi_layer%dtec",i+1);
00872     mePullTrackwidthProfileRphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00873 
00874     sprintf(histo,"PullTrackwidthProfile_Category1_rphi_layer%dtec",i+1);
00875     mePullTrackwidthProfileCategory1RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00876 
00877     sprintf(histo,"PullTrackwidthProfile_Category2_rphi_layer%dtec",i+1);
00878     mePullTrackwidthProfileCategory2RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00879     
00880     sprintf(histo,"PullTrackwidthProfile_Category3_rphi_layer%dtec",i+1);
00881     mePullTrackwidthProfileCategory3RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00882     
00883     sprintf(histo,"PullTrackwidthProfile_Category4_rphi_layer%dtec",i+1);
00884     mePullTrackwidthProfileCategory4RphiTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00885     
00886     sprintf(histo,"ErrxMFTrackwidthProfile_rphi_layer%dtec",i+1);
00887     meErrxMFTrackwidthProfileRphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00888 
00889     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_rphi_layer%dtec",i+1);
00890     meErrxMFTrackwidthProfileCategory1RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00891     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_rphi_layer%dtec",i+1);
00892     meErrxMFTrackwidthProfileCategory2RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00893     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_rphi_layer%dtec",i+1);
00894     meErrxMFTrackwidthProfileCategory3RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00895     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_rphi_layer%dtec",i+1);
00896     meErrxMFTrackwidthProfileCategory4RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00897 
00898     sprintf(histo,"ErrxMFAngleProfile_rphi_layer%dtec",i+1);
00899     meErrxMFAngleProfileRphiTEC[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00900 
00901     sprintf(histo,"ErrxMFClusterwidthProfile_Category1_rphi_layer%dtec",i+1);
00902     meErrxMFClusterwidthProfileCategory1RphiTEC[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00903     
00904   }
00905 
00906   //one histo per Layer stereo and matched hits: rings 1,2,5 are double sided
00907   for(int i = 0 ;i<5 ; i++) {
00908     if(i == 0 || i == 1 || i == 4) {
00909       Char_t histo[200];
00910       sprintf(histo,"Nstp_sas_layer%dtec",i+1);
00911       meNstpSasTEC[i] = dbe_->book1D(histo,"RecHit Cluster Size",20,0.5,20.5);  
00912       sprintf(histo,"Adc_sas_layer%dtec",i+1);
00913       meAdcSasTEC[i] = dbe_->book1D(histo,"RecHit Cluster Charge",100,0.,300.);  
00914       sprintf(histo,"Posx_sas_layer%dtec",i+1);
00915       mePosxSasTEC[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0,+6.0);  
00916       sprintf(histo,"Errx_LF_sas_layer%dtec",i+1);
00917       meErrxLFSasTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);  
00918       sprintf(histo,"Errx_MF_sas_layer%dtec",i+1);
00919       meErrxMFSasTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0.,0.5);  
00920       sprintf(histo,"Res_LF_sas_layer%dtec",i+1);
00921       meResLFSasTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-0.5,+0.5);  
00922       sprintf(histo,"Res_MF_sas_layer%dtec",i+1);
00923       meResMFSasTEC[i] = dbe_->book1D(histo,"RecHit Residual",100,-2,+2);  
00924       sprintf(histo,"Pull_LF_sas_layer%dtec",i+1);
00925       mePullLFSasTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
00926       sprintf(histo,"Pull_MF_sas_layer%dtec",i+1);
00927       mePullMFSasTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);
00928       sprintf(histo,"Trackangle_sas_layer%dtec",i+1);
00929       meTrackangleSasTEC[i] = dbe_->book1D(histo,"Track angle",100,-10.,10.);
00930       sprintf(histo,"Trackanglebeta_sas_layer%dtec",i+1);
00931       meTrackanglebetaSasTEC[i] = dbe_->book1D(histo,"Track angle beta",100,-10.,10.);
00932 
00933       sprintf(histo,"PullTrackangleProfile_sas_layer%dtec",i+1);
00934       mePullTrackangleProfileSasTEC[i] = dbe_->bookProfile(histo,"Pull Track angle Profile", 100, -10., 10.,100, -5., 5.,"s");
00935      
00936       sprintf(histo,"Trackwidth_sas_layer%dtec",i+1);
00937       meTrackwidthSasTEC[i] = dbe_->book1D(histo,"Track width",100,0.,1.);  
00938 
00939       sprintf(histo,"Expectedwidth_sas_layer%dtec",i+1);
00940       meExpectedwidthSasTEC[i] = dbe_->book1D(histo,"Expected width",10,0.,10.);  
00941 
00942       sprintf(histo,"Clusterwidth_sas_layer%dtec",i+1);
00943       meClusterwidthSasTEC[i] = dbe_->book1D(histo,"Cluster width",10,0.,10.);  
00944 
00945       sprintf(histo,"Category_sas_layer%dtec",i+1);
00946       meCategorySasTEC[i] = dbe_->book1D(histo,"Cluster Category",10,0.,10.);  
00947 
00948       sprintf(histo,"PullTrackwidthProfile_sas_layer%dtec",i+1);
00949       mePullTrackwidthProfileSasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile", 100, 0., 1.,100, -2.,2.,"s");
00950 
00951       sprintf(histo,"PullTrackwidthProfile_Category1_sas_layer%dtec",i+1);
00952       mePullTrackwidthProfileCategory1SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category1", 100, 0., 1.,100, -2.,2.,"s");
00953 
00954       sprintf(histo,"PullTrackwidthProfile_Category2_sas_layer%dtec",i+1);
00955       mePullTrackwidthProfileCategory2SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category2", 100, 0., 1.,100, -2.,2.,"s");
00956     
00957       sprintf(histo,"PullTrackwidthProfile_Category3_sas_layer%dtec",i+1);
00958       mePullTrackwidthProfileCategory3SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category3", 100, 0., 1.,100, -2.,2.,"s");
00959     
00960       sprintf(histo,"PullTrackwidthProfile_Category4_sas_layer%dtec",i+1);
00961       mePullTrackwidthProfileCategory4SasTEC[i] = dbe_->bookProfile(histo,"Pull Track width Profile Category4", 100, 0., 1.,100, -2.,2.,"s");
00962 
00963     sprintf(histo,"ErrxMFTrackwidthProfile_sas_layer%dtec",i+1);
00964     meErrxMFTrackwidthProfileSasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile", 12,0.,4.,100, -2.,2.,"s");
00965 
00966     sprintf(histo,"ErrxMFTrackwidthProfile_Category1_sas_layer%dtec",i+1);
00967     meErrxMFTrackwidthProfileCategory1SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category1", 12,0.,4.,100, -2.,2.,"s");
00968     sprintf(histo,"ErrxMFTrackwidthProfile_Category2_sas_layer%dtec",i+1);
00969     meErrxMFTrackwidthProfileCategory2SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category2", 12,0.,4.,100, -2.,2.,"s");
00970     sprintf(histo,"ErrxMFTrackwidthProfile_Category3_sas_layer%dtec",i+1);
00971     meErrxMFTrackwidthProfileCategory3SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category3", 12,0.,4.,100, -2.,2.,"s");
00972     sprintf(histo,"ErrxMFTrackwidthProfile_Category4_sas_layer%dtec",i+1);
00973     meErrxMFTrackwidthProfileCategory4SasTEC[i] = dbe_->bookProfile(histo,"Resolution Track width Profile Category4", 12,0.,4.,100, -2.,2.,"s");
00974 
00975     sprintf(histo,"ErrxMFAngleProfile_sas_layer%dtec",i+1);
00976     meErrxMFAngleProfileSasTEC[i] = dbe_->bookProfile(histo,"Resolution Angle Profile", 100, 0., 1.,100, -2.,2.,"s");
00977 
00978     sprintf(histo,"ErrxMFClusterwidthProfile_Category1_sas_layer%dtec",i+1);
00979     meErrxMFClusterwidthProfileCategory1SasTEC[i] = dbe_->bookProfile(histo,"Resolution Cluster width Profile Category1", 100, 0., 10.,100, -2.,2.,"s");
00980     
00981     sprintf(histo,"Posx_matched_layer%dtec",i+1);
00982     mePosxMatchedTEC[i] = dbe_->book1D(histo,"RecHit x coord.",100,-6.0, +6.0);  
00983     sprintf(histo,"Posy_matched_layer%dtec",i+1);
00984     mePosyMatchedTEC[i] = dbe_->book1D(histo,"RecHit y coord.",100,-8.0, +8.0);  
00985     sprintf(histo,"Errx_matched_layer%dtec",i+1);
00986     meErrxMatchedTEC[i] = dbe_->book1D(histo,"RecHit err(x) coord.",100,0., 0.02);  
00987     sprintf(histo,"Erry_matched_layer%dtec",i+1);
00988     meErryMatchedTEC[i] = dbe_->book1D(histo,"RecHit err(y) coord.",100,0., 0.1);  
00989     sprintf(histo,"Resx_matched_layer%dtec",i+1);
00990     meResxMatchedTEC[i] = dbe_->book1D(histo,"RecHit Res(x) coord.",100,-0.2, +0.2);  
00991     sprintf(histo,"Resy_matched_layer%dtec",i+1);
00992     meResyMatchedTEC[i] = dbe_->book1D(histo,"RecHit Res(y) coord.",100,-1., +1.);  
00993     sprintf(histo,"Pullx_matched_layer%dtec",i+1);
00994     mePullxMatchedTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00995     sprintf(histo,"Pully_matched_layer%dtec",i+1);
00996     mePullyMatchedTEC[i] = dbe_->book1D(histo,"Pull",100,-5.,5.);  
00997     }
00998   }
00999 
01000 
01001 }
01002 
01003 void SiStripTrackingRecHitsValid::endJob() {
01004 
01005   /*  
01006   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/ALL");
01007   
01008   PullvsTrackwidth->FitSlicesY();
01009   ErrxMFvsTrackwidth->FitSlicesY();
01010   PullvsExpectedwidth->FitSlicesY();
01011   PullvsClusterwidth->FitSlicesY();
01012   PullvsTrackangle->FitSlicesY();
01013   PullvsTrackanglebeta->FitSlicesY();
01014 
01015   PullvsTrackwidthTIB->FitSlicesY();
01016   PullvsExpectedwidthTIB->FitSlicesY();
01017   PullvsClusterwidthTIB->FitSlicesY();
01018   PullvsTrackangleTIB->FitSlicesY();
01019   PullvsTrackanglebetaTIB->FitSlicesY();
01020 
01021   PullvsTrackwidthTOB->FitSlicesY();
01022   PullvsExpectedwidthTOB->FitSlicesY();
01023   PullvsClusterwidthTOB->FitSlicesY();
01024   PullvsTrackangleTOB->FitSlicesY();
01025   PullvsTrackanglebetaTOB->FitSlicesY();
01026 
01027   PullvsTrackwidthTID->FitSlicesY();
01028   PullvsExpectedwidthTID->FitSlicesY();
01029   PullvsClusterwidthTID->FitSlicesY();
01030   PullvsTrackangleTID->FitSlicesY();
01031   PullvsTrackanglebetaTID->FitSlicesY();
01032 
01033   PullvsTrackwidthTEC->FitSlicesY();
01034   PullvsExpectedwidthTEC->FitSlicesY();
01035   PullvsClusterwidthTEC->FitSlicesY();
01036   PullvsTrackangleTEC->FitSlicesY();
01037   PullvsTrackanglebetaTEC->FitSlicesY();
01038 
01039   //int aaa = Pullvstrackwidth_1->GetEntries();ErrxMFvsTrackwidth
01040 
01041   TH1D *PullvsTrackwidth_2 = (TH1D*)gDirectory->Get("PullvsTrackwidth_2");
01042   TH1D *PullvsExpectedwidth_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidth_2");
01043   TH1D *PullvsClusterwidth_2 = (TH1D*)gDirectory->Get("PullvsClusterwidth_2");
01044   TH1D *PullvsTrackangle_2 = (TH1D*)gDirectory->Get("PullvsTrackangle_2");
01045   TH1D *PullvsTrackanglebeta_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebeta_2");
01046 
01047   TH1D *PullvsTrackwidthTIB_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTIB_2");
01048   TH1D *PullvsExpectedwidthTIB_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTIB_2");
01049   TH1D *PullvsClusterwidthTIB_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTIB_2");
01050   TH1D *PullvsTrackangleTIB_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTIB_2");
01051   TH1D *PullvsTrackanglebetaTIB_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTIB_2");
01052 
01053   TH1D *PullvsTrackwidthTOB_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTOB_2");
01054   TH1D *PullvsExpectedwidthTOB_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTOB_2");
01055   TH1D *PullvsClusterwidthTOB_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTOB_2");
01056   TH1D *PullvsTrackangleTOB_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTOB_2");
01057   TH1D *PullvsTrackanglebetaTOB_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTOB_2");
01058 
01059   TH1D *PullvsTrackwidthTID_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTID_2");
01060   TH1D *PullvsExpectedwidthTID_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTID_2");
01061   TH1D *PullvsClusterwidthTID_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTID_2");
01062   TH1D *PullvsTrackangleTID_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTID_2");
01063   TH1D *PullvsTrackanglebetaTID_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTID_2");
01064 
01065   TH1D *PullvsTrackwidthTEC_2 = (TH1D*)gDirectory->Get("PullvsTrackwidthTEC_2");
01066   TH1D *PullvsExpectedwidthTEC_2 = (TH1D*)gDirectory->Get("PullvsExpectedwidthTEC_2");
01067   TH1D *PullvsClusterwidthTEC_2 = (TH1D*)gDirectory->Get("PullvsClusterwidthTEC_2");
01068   TH1D *PullvsTrackangleTEC_2 = (TH1D*)gDirectory->Get("PullvsTrackangleTEC_2");
01069   TH1D *PullvsTrackanglebetaTEC_2 = (TH1D*)gDirectory->Get("PullvsTrackanglebetaTEC_2");
01070 
01071   //cout<<"h2_1->GetEntries() = "<<PullvsTrackwidth_1->GetEntries()<<endl;
01072   //cout<<"ddbb1"<<endl;
01073   unsigned int NBINSPullvsTrackwidth =PullvsTrackwidth_2->GetNbinsX();
01074   unsigned int NBINSPullvsClusterwidth = PullvsClusterwidth_2->GetNbinsX();
01075   unsigned int NBINSPullvsExpectedwidth = PullvsExpectedwidth_2->GetNbinsX();
01076   //cout<<"ddbb2"<<endl;
01077   unsigned int NBINSPullvsTrackangle = PullvsTrackangle_2->GetNbinsX();
01078   unsigned int NBINSPullvsTrackanglebeta = PullvsTrackanglebeta_2->GetNbinsX();
01079   //cout<<"ddbb3"<<endl;
01080 
01081   PullRMSvsTrackwidth = dbe_->book1D("PullRMSvsTrackwidth", "PullRMSvsTrackwidth",NBINSPullvsTrackwidth ,0.,4.);
01082   PullRMSvsClusterwidth = dbe_->book1D("PullRMSvsClusterwidth", "PullRMSvsClusterwidth",NBINSPullvsClusterwidth ,0.5,8.5);
01083   PullRMSvsExpectedwidth = dbe_->book1D("PullRMSvsExpectedwidth", "PullRMSvsExpectedwidth",NBINSPullvsExpectedwidth ,0.5,4.5);
01084   PullRMSvsTrackangle = dbe_->book1D("PullRMSvsTrackangle", "PullRMSvsTrackangle",NBINSPullvsTrackangle ,0.,90.);
01085   PullRMSvsTrackanglebeta = dbe_->book1D("PullRMSvsTrackanglebeta", "PullRMSvsTrackanglebeta",NBINSPullvsTrackanglebeta ,0.,90.);
01086 
01087   PullRMSvsTrackwidthTIB = dbe_->book1D("PullRMSvsTrackwidthTIB", "PullRMSvsTrackwidthTIB",NBINSPullvsTrackwidth ,0.,4.);
01088   PullRMSvsClusterwidthTIB = dbe_->book1D("PullRMSvsClusterwidthTIB", "PullRMSvsClusterwidthTIB",NBINSPullvsClusterwidth ,0.5,8.5);
01089   PullRMSvsExpectedwidthTIB = dbe_->book1D("PullRMSvsExpectedwidthTIB", "PullRMSvsExpectedwidthTIB",NBINSPullvsExpectedwidth ,0.5,4.5);
01090   PullRMSvsTrackangleTIB = dbe_->book1D("PullRMSvsTrackangleTIB", "PullRMSvsTrackangleTIB",NBINSPullvsTrackangle ,0.,90.);
01091   PullRMSvsTrackanglebetaTIB = dbe_->book1D("PullRMSvsTrackanglebetaTIB", "PullRMSvsTrackanglebetaTIB",NBINSPullvsTrackanglebeta ,0.,90.);
01092 
01093   PullRMSvsTrackwidthTOB = dbe_->book1D("PullRMSvsTrackwidthTOB", "PullRMSvsTrackwidthTOB",NBINSPullvsTrackwidth ,0.,4.);
01094   PullRMSvsClusterwidthTOB = dbe_->book1D("PullRMSvsClusterwidthTOB", "PullRMSvsClusterwidthTOB",NBINSPullvsClusterwidth ,0.5,8.5);
01095   PullRMSvsExpectedwidthTOB = dbe_->book1D("PullRMSvsExpectedwidthTOB", "PullRMSvsExpectedwidthTOB",NBINSPullvsExpectedwidth ,0.5,4.5);
01096   PullRMSvsTrackangleTOB = dbe_->book1D("PullRMSvsTrackangleTOB", "PullRMSvsTrackangleTOB",NBINSPullvsTrackangle ,0.,90.);
01097   PullRMSvsTrackanglebetaTOB = dbe_->book1D("PullRMSvsTrackanglebetaTOB", "PullRMSvsTrackanglebetaTOB",NBINSPullvsTrackanglebeta ,0.,90.);
01098 
01099   PullRMSvsTrackwidthTID = dbe_->book1D("PullRMSvsTrackwidthTID", "PullRMSvsTrackwidthTID",NBINSPullvsTrackwidth ,0.,4.);
01100   PullRMSvsClusterwidthTID = dbe_->book1D("PullRMSvsClusterwidthTID", "PullRMSvsClusterwidthTID",NBINSPullvsClusterwidth ,0.5,8.5);
01101   PullRMSvsExpectedwidthTID = dbe_->book1D("PullRMSvsExpectedwidthTID", "PullRMSvsExpectedwidthTID",NBINSPullvsExpectedwidth ,0.5,4.5);
01102   PullRMSvsTrackangleTID = dbe_->book1D("PullRMSvsTrackangleTID", "PullRMSvsTrackangleTID",NBINSPullvsTrackangle ,0.,90.);
01103   PullRMSvsTrackanglebetaTID = dbe_->book1D("PullRMSvsTrackanglebetaTID", "PullRMSvsTrackanglebetaTID",NBINSPullvsTrackanglebeta ,0.,90.);
01104 
01105   PullRMSvsTrackwidthTEC = dbe_->book1D("PullRMSvsTrackwidthTEC", "PullRMSvsTrackwidthTEC",NBINSPullvsTrackwidth ,0.,4.);
01106   PullRMSvsClusterwidthTEC = dbe_->book1D("PullRMSvsClusterwidthTEC", "PullRMSvsClusterwidthTEC",NBINSPullvsClusterwidth ,0.5,8.5);
01107   PullRMSvsExpectedwidthTEC = dbe_->book1D("PullRMSvsExpectedwidthTEC", "PullRMSvsExpectedwidthTEC",NBINSPullvsExpectedwidth ,0.5,4.5);
01108   PullRMSvsTrackangleTEC = dbe_->book1D("PullRMSvsTrackangleTEC", "PullRMSvsTrackangleTEC",NBINSPullvsTrackangle ,0.,90.);
01109   PullRMSvsTrackanglebetaTEC = dbe_->book1D("PullRMSvsTrackanglebetaTEC", "PullRMSvsTrackanglebetaTEC",NBINSPullvsTrackanglebeta ,0.,90.);
01110 
01111   //cout<<"ddbb5"<<endl;
01112   for(unsigned int i = 0; i !=NBINSPullvsTrackwidth ; ++i){
01113     PullRMSvsTrackwidth->setBinContent(i,PullvsTrackwidth_2 ->GetBinContent(i));
01114     PullRMSvsTrackwidth->setBinError(i,PullvsTrackwidth_2 ->GetBinError(i));
01115     PullRMSvsTrackwidthTIB->setBinContent(i,PullvsTrackwidthTIB_2 ->GetBinContent(i));
01116     PullRMSvsTrackwidthTIB->setBinError(i,PullvsTrackwidthTIB_2 ->GetBinError(i));
01117     PullRMSvsTrackwidthTOB->setBinContent(i,PullvsTrackwidthTOB_2 ->GetBinContent(i));
01118     PullRMSvsTrackwidthTOB->setBinError(i,PullvsTrackwidthTOB_2 ->GetBinError(i));
01119     PullRMSvsTrackwidthTID->setBinContent(i,PullvsTrackwidthTID_2 ->GetBinContent(i));
01120     PullRMSvsTrackwidthTID->setBinError(i,PullvsTrackwidthTID_2 ->GetBinError(i));
01121     PullRMSvsTrackwidthTEC->setBinContent(i,PullvsTrackwidthTEC_2 ->GetBinContent(i));
01122     PullRMSvsTrackwidthTEC->setBinError(i,PullvsTrackwidthTEC_2 ->GetBinError(i));
01123   }
01124   //cout<<"ddbb6"<<endl;
01125   for(unsigned int i = 0; i != NBINSPullvsClusterwidth; ++i){
01126     PullRMSvsClusterwidth->setBinContent(i,PullvsClusterwidth_2 ->GetBinContent(i));
01127     PullRMSvsClusterwidth->setBinError(i,PullvsClusterwidth_2 ->GetBinError(i));
01128     PullRMSvsClusterwidthTIB->setBinContent(i,PullvsClusterwidthTIB_2 ->GetBinContent(i));
01129     PullRMSvsClusterwidthTIB->setBinError(i,PullvsClusterwidthTIB_2 ->GetBinError(i));
01130     PullRMSvsClusterwidthTOB->setBinContent(i,PullvsClusterwidthTOB_2 ->GetBinContent(i));
01131     PullRMSvsClusterwidthTOB->setBinError(i,PullvsClusterwidthTOB_2 ->GetBinError(i));
01132     PullRMSvsClusterwidthTID->setBinContent(i,PullvsClusterwidthTID_2 ->GetBinContent(i));
01133     PullRMSvsClusterwidthTID->setBinError(i,PullvsClusterwidthTID_2 ->GetBinError(i));
01134     PullRMSvsClusterwidthTEC->setBinContent(i,PullvsClusterwidthTEC_2 ->GetBinContent(i));
01135     PullRMSvsClusterwidthTEC->setBinError(i,PullvsClusterwidthTEC_2 ->GetBinError(i));
01136   }
01137   //cout<<"ddbb7"<<endl;
01138   for(unsigned int i = 0; i != NBINSPullvsExpectedwidth; ++i){
01139     PullRMSvsExpectedwidth->setBinContent(i,PullvsExpectedwidth_2 ->GetBinContent(i));
01140     PullRMSvsExpectedwidth->setBinError(i,PullvsExpectedwidth_2 ->GetBinError(i));
01141     PullRMSvsExpectedwidthTIB->setBinContent(i,PullvsExpectedwidthTIB_2 ->GetBinContent(i));
01142     PullRMSvsExpectedwidthTIB->setBinError(i,PullvsExpectedwidthTIB_2 ->GetBinError(i));
01143     PullRMSvsExpectedwidthTOB->setBinContent(i,PullvsExpectedwidthTOB_2 ->GetBinContent(i));
01144     PullRMSvsExpectedwidthTOB->setBinError(i,PullvsExpectedwidthTOB_2 ->GetBinError(i));
01145     PullRMSvsExpectedwidthTID->setBinContent(i,PullvsExpectedwidthTID_2 ->GetBinContent(i));
01146     PullRMSvsExpectedwidthTID->setBinError(i,PullvsExpectedwidthTID_2 ->GetBinError(i));
01147     PullRMSvsExpectedwidthTEC->setBinContent(i,PullvsExpectedwidthTEC_2 ->GetBinContent(i));
01148     PullRMSvsExpectedwidthTEC->setBinError(i,PullvsExpectedwidthTEC_2 ->GetBinError(i));
01149   }
01150   //cout<<"ddbb8"<<endl;
01151   for(unsigned int i = 0; i != NBINSPullvsTrackangle; ++i){
01152     PullRMSvsTrackangle->setBinContent(i,PullvsTrackangle_2 ->GetBinContent(i));
01153     PullRMSvsTrackangle->setBinError(i,PullvsTrackangle_2 ->GetBinError(i));
01154     PullRMSvsTrackangleTIB->setBinContent(i,PullvsTrackangleTIB_2 ->GetBinContent(i));
01155     PullRMSvsTrackangleTIB->setBinError(i,PullvsTrackangleTIB_2 ->GetBinError(i));
01156     PullRMSvsTrackangleTOB->setBinContent(i,PullvsTrackangleTOB_2 ->GetBinContent(i));
01157     PullRMSvsTrackangleTOB->setBinError(i,PullvsTrackangleTOB_2 ->GetBinError(i));
01158     PullRMSvsTrackangleTID->setBinContent(i,PullvsTrackangleTID_2 ->GetBinContent(i));
01159     PullRMSvsTrackangleTID->setBinError(i,PullvsTrackangleTID_2 ->GetBinError(i));
01160     PullRMSvsTrackangleTEC->setBinContent(i,PullvsTrackangleTEC_2 ->GetBinContent(i));
01161     PullRMSvsTrackangleTEC->setBinError(i,PullvsTrackangleTEC_2 ->GetBinError(i));
01162   }
01163   //cout<<"ddbb9"<<endl;
01164   for(unsigned int i = 0; i !=NBINSPullvsTrackanglebeta ; ++i){
01165     PullRMSvsTrackanglebeta->setBinContent(i,PullvsTrackanglebeta_2 ->GetBinContent(i));
01166     PullRMSvsTrackanglebeta->setBinError(i,PullvsTrackanglebeta_2 ->GetBinError(i));
01167     PullRMSvsTrackanglebetaTIB->setBinContent(i,PullvsTrackanglebetaTIB_2 ->GetBinContent(i));
01168     PullRMSvsTrackanglebetaTIB->setBinError(i,PullvsTrackanglebetaTIB_2 ->GetBinError(i));
01169     PullRMSvsTrackanglebetaTOB->setBinContent(i,PullvsTrackanglebetaTOB_2 ->GetBinContent(i));
01170     PullRMSvsTrackanglebetaTOB->setBinError(i,PullvsTrackanglebetaTOB_2 ->GetBinError(i));
01171     PullRMSvsTrackanglebetaTID->setBinContent(i,PullvsTrackanglebetaTID_2 ->GetBinContent(i));
01172     PullRMSvsTrackanglebetaTID->setBinError(i,PullvsTrackanglebetaTID_2 ->GetBinError(i));
01173     PullRMSvsTrackanglebetaTEC->setBinContent(i,PullvsTrackanglebetaTEC_2 ->GetBinContent(i));
01174     PullRMSvsTrackanglebetaTEC->setBinError(i,PullvsTrackanglebetaTEC_2 ->GetBinError(i));
01175   }  
01176 */  
01177 
01178 
01179   
01180   /*
01181   dbe_->setCurrentFolder("RecoTrackV/TrackingRecHits/Strip/ALL");
01182   unsigned int NBINS = meErrxMFTrackwidthProfile->getNbinsX();
01183   float Entries = meErrxMFTrackwidthProfile->getEntries();
01184   cout<<"Entries = "<<Entries<<endl;
01185   cout<<"NBINS = "<<NBINS<<endl;
01186   NBINS=100;
01187   new_1D = dbe_->book1D("my_name", "my_title", NBINS,0.,5.);
01188   for(unsigned int i = 0; i != NBINS; ++i){
01189     cout<<"i,   getBinError(i) = "<<i<<";"<<meErrxMFTrackwidthProfile ->getBinError(i)<<endl;
01190    new_1D->setBinContent(i,meErrxMFTrackwidthProfile ->getBinError(i));
01191   }
01192   */
01193 
01194   /*
01195     myFile->cd();
01196 
01197     PositionSHx->Write();
01198     Diff->Write();
01199     SecondStrip->Write();
01200     ErrxMF->Write();
01201     ErrxMFvsTrackwidth->Write();
01202     ResMFvsTrackwidth->Write();
01203     ResMFvsTrackwidthWClus1->Write();
01204     ResMFvsTrackwidthWClus1Wexp1->Write();
01205     ResMFvsTrackwidthWClus1Wexp2->Write();
01206     ResMFvsTrackwidthWClus1Wexp3->Write();
01207     ResMFvsTrackwidthWClus1Wexp4->Write();
01208     ResMFvsTrackwidthWClus2->Write();
01209     ResMFvsTrackwidthWClus2Wexp1->Write();
01210     ResMFvsTrackwidthWClus2Wexp2->Write();
01211     ResMFvsTrackwidthWClus2Wexp3->Write();
01212     ResMFvsTrackwidthWClus2Wexp4->Write();
01213     ResMFvsTrackwidthWClus3->Write();
01214     ResMFvsTrackwidthWClus3Wexp1->Write();
01215     ResMFvsTrackwidthWClus3Wexp2->Write();
01216     ResMFvsTrackwidthWClus3Wexp3->Write();
01217     ResMFvsTrackwidthWClus3Wexp4->Write();
01218     ResMFvsTrackwidthWClus4->Write();
01219     ResMFvsTrackwidthWClus4Wexp1->Write();
01220     ResMFvsTrackwidthWClus4Wexp2->Write();
01221     ResMFvsTrackwidthWClus4Wexp3->Write();
01222     ResMFvsTrackwidthWClus4Wexp4->Write();
01223     ErrxMFvsTrackwidthWClus1->Write();
01224     ErrxMFvsTrackwidthWClus2->Write();
01225     ErrxMFvsTrackwidthWClus3->Write();
01226     ErrxMFvsTrackwidthWClus4->Write();
01227 
01228     ResMFvsTrackwidthCategory2->Write();
01229     ResMFvsTrackwidthCategory3->Write();
01230     ResMFvsTrackwidthCategory4->Write();
01231 
01232     ErrxMFvsTrackwidthCategory2->Write();
01233     ErrxMFvsTrackwidthCategory3->Write();
01234     ErrxMFvsTrackwidthCategory4->Write();
01235 
01236     //    ErrxMFvsTrackwidth_1->Write();
01237     //ErrxMFvsTrackwidth_2->Write();
01238 
01239     PullvsTrackwidth->Write();
01240     //PullvsTrackwidth_1 ->Write();
01241     //PullvsTrackwidth_2 ->Write();
01242     PullvsExpectedwidth->Write();
01243     PullvsExpectedwidth_1 ->Write();
01244     PullvsExpectedwidth_2 ->Write();
01245     PullvsClusterwidth->Write();
01246     PullvsClusterwidth_1 ->Write();
01247     PullvsClusterwidth_2 ->Write();
01248     PullvsTrackangle->Write();
01249     PullvsTrackangle_1 ->Write();
01250     PullvsTrackangle_2 ->Write();
01251     PullvsTrackanglebeta->Write();
01252     PullvsTrackanglebeta_1 ->Write();
01253     PullvsTrackanglebeta_2 ->Write();
01254     myFile->Close();
01255   */
01256 
01257 
01258   if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
01259 }
01260 
01261 // Virtual destructor needed.
01262 SiStripTrackingRecHitsValid::~SiStripTrackingRecHitsValid() {  
01263 
01264 }  
01265 
01266 // Functions that gets called by framework every event
01267 void SiStripTrackingRecHitsValid::analyze(const edm::Event& e, const edm::EventSetup& es)
01268 {
01269   
01270   // EventID e.id() ;
01271 
01272   float diff=0;
01273   float positionshx = 0;
01274   int secondstrip = 0;
01275 
01276   int isrechitrphi     = 0;
01277   int isrechitsas      = 0;
01278   int isrechitmatched  = 0;
01279 
01280   float anglealpha;
01281   float anglebeta;
01282   float Wtrack;
01283   int Wexp;
01284   int clusterWidth;
01285   DetId detid;
01286   uint32_t myid;
01287 
01288   LocalPoint position;
01289   LocalError error;
01290   MeasurementPoint Mposition;
01291   MeasurementError Merror;
01292 
01293   int clusiz=0;
01294   int totcharge=0;
01295 
01296 
01297   float mindist = 999999;
01298   float dist;
01299   std::vector<PSimHit> matched;
01300   
01301   TrackerHitAssociator associate(e, conf_);
01302   PSimHit closest;
01303 
01304   
01305 
01306   edm::ESHandle<TrackerGeometry> pDD;
01307   es.get<TrackerDigiGeometryRecord> ().get (pDD);
01308   const TrackerGeometry &tracker(*pDD);
01309 
01310   const TrackerGeometry * tracker2;
01311   edm::ESHandle<TrackerGeometry> estracker;
01312   es.get<TrackerDigiGeometryRecord>().get(estracker);
01313   tracker2=&(* estracker);
01314 
01315   edm::ESHandle<MagneticField> magfield;
01316   //iRecord.getRecord<IdealMagneticFieldRecord>().get(magfield );
01317   es.get<IdealMagneticFieldRecord>().get(magfield );
01318   //  magfield_  = magfield;
01319   //const magfield_
01320   const MagneticField & magfield_ (*magfield);
01321   magfield2_ = &magfield_;
01322 
01323 
01324   edm::ESHandle<StripClusterParameterEstimator> stripcpe;
01325   es.get<TkStripCPERecord>().get("SimpleStripCPE",stripcpe);
01326 
01327     //
01328 
01329 
01330   // Mangano's
01331 
01332   edm::Handle<vector<Trajectory> > trajCollectionHandle;
01333   e.getByLabel(conf_.getParameter<string>("trajectoryInput"),trajCollectionHandle);
01334 
01335   edm::LogVerbatim("TrajectoryAnalyzer") << "trajColl->size(): " << trajCollectionHandle->size() ;
01336 
01337   //cout<<"trajColl->size() = "<<trajCollectionHandle->size()<<endl;
01338   
01339   for(vector<Trajectory>::const_iterator it = trajCollectionHandle->begin(); it!=trajCollectionHandle->end();it++){
01340      
01341     edm::LogVerbatim("TrajectoryAnalyzer") << "this traj has " << it->foundHits() << " valid hits"  << " , "
01342                                             << "isValid: " << it->isValid() ;
01343 
01344     vector<TrajectoryMeasurement> tmColl = it->measurements();
01345     for(vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin(); itTraj!=tmColl.end(); itTraj++){
01346       if(! itTraj->updatedState().isValid()) continue;
01347            
01348 //        edm::LogVerbatim("TrajectoryAnalyzer") << "tm number: " << (itTraj - tmColl.begin()) + 1<< " , "
01349 //        << "tm.backwardState.pt: " << itTraj->backwardPredictedState().globalMomentum().perp() << " , "
01350 //        << "tm.forwardState.pt:  " << itTraj->forwardPredictedState().globalMomentum().perp() << " , "
01351 //        << "tm.updatedState.pt:  " << itTraj->updatedState().globalMomentum().perp()  << " , "
01352 //        << "tm.globalPos.perp: "   << itTraj->updatedState().globalPosition().perp() ;       
01353        
01354                if ( itTraj->updatedState().globalMomentum().perp() < 1.) continue;
01355                
01356       TrajectoryStateOnSurface tsos=itTraj->updatedState();
01357       LocalVector trackdirection=tsos.localDirection();
01358 
01359       DetId  detid2 = itTraj->recHit()->geographicalId();
01360 
01361       const TransientTrackingRecHit::ConstRecHitPointer thit2=itTraj->recHit();
01362       const SiStripMatchedRecHit2D* matchedhit=dynamic_cast<const SiStripMatchedRecHit2D*>((*thit2).hit());
01363       const SiStripRecHit2D* hit=dynamic_cast<const SiStripRecHit2D*>((*thit2).hit());
01364       //if(matchedhit) cout<<"manganomatchedhit"<<endl;
01365       //if(hit) cout<<"manganosimplehit"<<endl;
01366       //if (hit && matchedhit) cout<<"manganosimpleandmatchedhit"<<endl;
01367       const TrackingRecHit *thit = (*thit2).hit();
01368             
01369       detid = (thit)->geographicalId();
01370       myid=((thit)->geographicalId()).rawId();
01371 
01372       StripSubdetector StripSubdet = (StripSubdetector) detid;
01373 
01374       isrechitmatched  = 0;
01375       
01376       if(matchedhit){
01377 
01378         isrechitmatched = 1;
01379  
01380         position = (thit)->localPosition();
01381         //  Mposition = topol.measurementPosition(position);
01382         error = (thit)->localPositionError();
01383         //  Merror = topol.measurementError(position,error);
01384         rechitmatchedx = position.x();
01385         rechitmatchedy = position.y();
01386         rechitmatchedz = position.z();
01387         rechitmatchederrxx = error.xx();
01388         rechitmatchederrxy = error.xy();
01389         rechitmatchederryy = error.yy();
01390 
01391         //Association of the rechit to the simhit
01392         mindist = 999999;
01393         float distx, disty;
01394         std::pair<LocalPoint,LocalVector> closestPair;
01395         matched.clear();
01396         matched = associate.associateHit(*matchedhit);
01397         if(!matched.empty()){
01398           //project simhit;
01399           const GluedGeomDet* gluedDet = (const GluedGeomDet*)tracker.idToDet(matchedhit->geographicalId());
01400           const StripGeomDetUnit* partnerstripdet =(StripGeomDetUnit*) gluedDet->stereoDet();
01401           std::pair<LocalPoint,LocalVector> hitPair;
01402           for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01403             //project simhit;
01404             hitPair= projectHit((*m),partnerstripdet,gluedDet->surface());
01405             distx = fabs(rechitmatchedx - hitPair.first.x());
01406             disty = fabs(rechitmatchedy - hitPair.first.y());
01407             dist = distx*distx+disty*disty;
01408             if(sqrt(dist)<mindist){
01409               mindist = dist;
01410               closestPair = hitPair;
01411             }
01412           }
01413           rechitmatchedresx = rechitmatchedx - closestPair.first.x();
01414           rechitmatchedresy = rechitmatchedy - closestPair.first.y();
01415           rechitmatchedpullx = ((thit)->localPosition().x() - (closestPair.first.x()))/sqrt(error.xx());
01416           rechitmatchedpully = ((thit)->localPosition().y() - (closestPair.first.y()))/sqrt(error.yy());
01417         }
01418       }
01419  
01420       //Filling Histograms for Matched hits
01421 
01422       if(isrechitmatched){
01423 
01424         if (detid.subdetId() == int(StripSubdetector::TIB)){
01425           TIBDetId tibid(myid);
01426           int Tibisrechitmatched = isrechitmatched;
01427           int ilay = tibid.layer() - 1; //for histogram filling
01428           if(Tibisrechitmatched>0){
01429             mePosxMatchedTIB[ilay]->Fill(rechitmatchedx);
01430             meErrxMatchedTIB[ilay]->Fill(sqrt(rechitmatchederrxx));
01431             meErryMatchedTIB[ilay]->Fill(sqrt(rechitmatchederryy));
01432             meResxMatchedTIB[ilay]->Fill(rechitmatchedresx);
01433             meResyMatchedTIB[ilay]->Fill(rechitmatchedresy);
01434             mePullxMatchedTIB[ilay]->Fill(rechitmatchedpullx);
01435             mePullyMatchedTIB[ilay]->Fill(rechitmatchedpully);
01436 
01437           }
01438         }
01439               
01440         if (detid.subdetId() == int(StripSubdetector::TOB)){
01441           TOBDetId tobid(myid);
01442           int Tobisrechitmatched = isrechitmatched;
01443           int ilay = tobid.layer() - 1; //for histogram filling
01444           if(Tobisrechitmatched>0){
01445             mePosxMatchedTOB[ilay]->Fill(rechitmatchedx);
01446             mePosyMatchedTOB[ilay]->Fill(rechitmatchedy);
01447             meErrxMatchedTOB[ilay]->Fill(sqrt(rechitmatchederrxx));
01448             meErryMatchedTOB[ilay]->Fill(sqrt(rechitmatchederryy));
01449             meResxMatchedTOB[ilay]->Fill(rechitmatchedresx);
01450             meResyMatchedTOB[ilay]->Fill(rechitmatchedresy);
01451             mePullxMatchedTOB[ilay]->Fill(rechitmatchedpullx);
01452             mePullyMatchedTOB[ilay]->Fill(rechitmatchedpully);
01453           }
01454         }
01455         if (detid.subdetId() == int(StripSubdetector::TID)){
01456           TIDDetId tidid(myid);
01457           int Tidisrechitmatched = isrechitmatched;
01458           int ilay = tidid.ring() - 1; //for histogram filling
01459           if(Tidisrechitmatched>0){
01460             mePosxMatchedTID[ilay]->Fill(rechitmatchedx);
01461             mePosyMatchedTID[ilay]->Fill(rechitmatchedy);
01462             meErrxMatchedTID[ilay]->Fill(sqrt(rechitmatchederrxx));
01463             meErryMatchedTID[ilay]->Fill(sqrt(rechitmatchederryy));
01464             meResxMatchedTID[ilay]->Fill(rechitmatchedresx);
01465             meResyMatchedTID[ilay]->Fill(rechitmatchedresy);
01466             mePullxMatchedTID[ilay]->Fill(rechitmatchedpullx);
01467             mePullyMatchedTID[ilay]->Fill(rechitmatchedpully);
01468           }
01469         }
01470         if (detid.subdetId() == int(StripSubdetector::TEC)){
01471           TECDetId tecid(myid);
01472           int Tecisrechitmatched = isrechitmatched;
01473           int ilay = tecid.ring() - 1; //for histogram filling
01474           if(Tecisrechitmatched>0){
01475             mePosxMatchedTEC[ilay]->Fill(rechitmatchedx);
01476             mePosyMatchedTEC[ilay]->Fill(rechitmatchedy);
01477             meErrxMatchedTEC[ilay]->Fill(sqrt(rechitmatchederrxx));
01478             meErryMatchedTEC[ilay]->Fill(sqrt(rechitmatchederryy));
01479             meResxMatchedTEC[ilay]->Fill(rechitmatchedresx);
01480             meResyMatchedTEC[ilay]->Fill(rechitmatchedresy);
01481             mePullxMatchedTEC[ilay]->Fill(rechitmatchedpullx);
01482             mePullyMatchedTEC[ilay]->Fill(rechitmatchedpully);
01483           }
01484         }
01485               
01486       }
01487       
01488               
01490       // simple hits from matched hits
01492       // Reset variables
01493       
01494       isrechitrphi    = 0;
01495       isrechitsas     = 0;
01496       rechitrphix =0;
01497       rechitrphierrxLF =0;
01498       rechitrphierrxMF =0;
01499       rechitrphiy =0;
01500       rechitrphiz =0;
01501       rechitsasx =0;
01502       rechitsaserrxLF =0;
01503       rechitsaserrxMF =0;
01504       rechitsasy =0;
01505       rechitsasz =0;
01506       clusizrphi =0;
01507       clusizsas =0;
01508       cluchgrphi =0;
01509       cluchgsas =0;
01510       rechitrphiresLF=-999.;
01511       rechitrphiresMF=-999.;
01512       rechitrphipullLF=-999.;
01513       rechitrphipullMF=-999.;
01514       rechitrphitrackangle =0;
01515       rechitrphitrackanglebeta =0;
01516       rechitrphitrackangle2 =0;
01517       rechitrphitrackwidth =0;
01518       rechitrphiexpectedwidth =0;
01519       rechitrphicategory =0;
01520       rechitrphithickness = 0.;
01521       rechitsasresLF=-999.;
01522       rechitsasresMF=-999.;
01523       rechitsaspullLF=-999.;
01524       rechitsaspullMF=-999.;
01525       rechitsastrackangle =0;
01526       rechitsastrackanglebeta =0;
01527       rechitsasthickness = 0;
01528 
01529       GluedGeomDet * gdet;
01530       const GeomDetUnit * monodet;
01531       const SiStripRecHit2D *monohit;
01532       const StripGeomDetUnit * stripdet;
01533 
01534       if (matchedhit)
01535         {
01536           monohit=matchedhit->monoHit();
01537           //      const GeomDetUnit * monodet=gdet->monoDet();
01538           gdet=(GluedGeomDet *)tracker2->idToDet(matchedhit->geographicalId());
01539           monodet=gdet->monoDet();
01540           GlobalVector gtrkdir=gdet->toGlobal(trackdirection);
01541           LocalVector monotkdir=monodet->toLocal(gtrkdir);
01542           //      const GeomDetUnit *  det = tracker.idToDetUnit(detid);
01543           //stripdet=(const StripGeomDetUnit*)(gdet);
01544           stripdet=(const StripGeomDetUnit*)(monodet);
01545           //      const StripTopology &topol2=(StripTopology&)stripdet->topology();
01546 
01547           if(monotkdir.z()!=0){
01548             anglealpha = atan(monotkdir.x()/monotkdir.z())*180/TMath::Pi();
01549             anglebeta = atan(monotkdir.y()/monotkdir.z())*180/TMath::Pi();
01550           }
01551           
01552           if(monohit){
01553 
01554             const StripTopology &topol=(StripTopology&)stripdet->topology();
01555 
01556             position = monohit->localPosition();
01557             error = monohit->localPositionError();
01558             Mposition = topol.measurementPosition(position);
01559             Merror = topol.measurementError(position,error);
01560 
01561             LocalVector drift = stripcpe->driftDirection(stripdet);
01562             float thickness=stripdet->surface().bounds().thickness();
01563             rechitrphithickness = thickness;
01564 
01565             //cout<<"thickness = "<<thickness<<endl;
01566             float pitch = topol.localPitch(position);
01567             //cout<<"Valid:pitch = "<<pitch<<endl;
01568             float tanalpha = tan(anglealpha/57.3);
01569             //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01570             float tanalphaL = drift.x()/drift.z();
01571             //float tanalphaLbis = driftbis.x()/driftbis.z();
01572             //float tanalphaLter = driftter.x()/driftter.z();
01573             //cout<<"Validmonofrommatched:drift.x() = "<<drift.x()<<endl;
01574             //cout<<"Valid:drift.x() = "<<drift.x()<<endl;
01575             //cout<<"Valid:driftbis.x() = "<<driftbis.x()<<endl;
01576             //cout<<"Valid:driftter.x() = "<<driftter.x()<<endl;
01577             //cout<<"Valid:driftter.z() = "<<driftter.z()<<endl;
01578             //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01579             Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01580             //cout<<"Valid1:Wtrack = "<<Wtrack<<endl;
01581             float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01582             //int nstrips = topol.nstrips(); 
01583             //clusterWidth = cluster->amplitudes().size();
01584             int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01585             int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01586             Wexp = 1+Sp-Sm;
01587             //cout<<"DebugLine22"<<endl;
01588 
01589             isrechitrphi = 1;
01590             //cout<<"DebugLine23"<<endl;
01591             //          const edm::Ref<edm::DetSetVector<SiStripCluster>, SiStripCluster, edm::refhelper::FindForDetSetVector<SiStripCluster> > cluster=hit->cluster();
01592             SiStripRecHit2D::ClusterRef cluster=monohit->cluster();
01593             clusiz=0;
01594             totcharge=0;
01595             clusiz = cluster->amplitudes().size();
01596             //      cout<<"clusiz = "<<clusiz<<endl;
01597             const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01598             for(size_t ia=0; ia<amplitudes.size();ia++){
01599               totcharge+=amplitudes[ia];
01600             }
01601             rechitrphix = position.x();
01602             rechitrphiy = position.y();
01603             rechitrphiz = position.z();
01604             rechitrphierrxLF = error.xx();
01605             rechitrphierrxMF = Merror.uu();
01606             //      cout<<"rechitrphierrxMF from Matched hit= "<<sqrt(rechitrphierrxMF)<<endl;
01607             clusizrphi = clusiz;
01608             cluchgrphi = totcharge;
01609 
01610             //Association of the rechit to the simhit
01611             mindist = 999999;
01612             matched.clear();  
01613             //          matched = associate.associateHit(*hit);
01614             matched = associate.associateHit(*monohit);
01615             if(!matched.empty()){
01616               //                  cout << "\t\t\tmatched  " << matched.size() << endl;
01617               //              cout<<"associatesimplehit"<<endl;
01618               for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01619                 dist = abs((monohit)->localPosition().x() - (*m).localPosition().x());
01620                 if(dist<mindist){
01621                   mindist = dist;
01622                   closest = (*m);
01623                 }
01624                 rechitrphiresLF = rechitrphix - closest.localPosition().x();
01625                 rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
01626                 rechitrphipullLF =  rechitrphiresLF/sqrt(rechitrphierrxLF);
01627                 rechitrphipullMF = rechitrphiresMF/sqrt(rechitrphierrxMF);
01628                 //cout<<"rechitrphiresMF == "<<rechitrphiresMF<<endl;
01629                 //cout<<"rechitrphierrxMF == "<<rechitrphierrxMF<<endl;
01630                 //cout<<"rechitrphierrxLF == "<<rechitrphierrxLF<<endl;
01631                 //cout<<"rechitrphipullMF == "<<rechitrphipullMF<<endl;
01632 
01633               }
01634             }
01635             rechitrphitrackangle = anglealpha;
01636             rechitrphitrackanglebeta = anglebeta;
01637             //rechitrphitrackangle = tanalphaL;
01638             //cout<<"Wtrack = "<<Wtrack<<endl;
01639             rechitrphitrackwidth = Wtrack;
01640             rechitrphiexpectedwidth = Wexp;
01641             clusterWidth = clusiz;
01642             unsigned int iopt;
01643             if (clusterWidth > Wexp + 2) {
01644               iopt = 1;
01645             } else if (Wexp == 1) {
01646               iopt = 2;
01647             } else if (clusterWidth <= Wexp) {
01648               iopt = 3;
01649             } else {
01650               iopt = 4;
01651             }
01652             rechitrphicategory = iopt;
01653           }
01654            
01655  
01656           const SiStripRecHit2D *stereohit;
01657           stereohit=matchedhit->stereoHit();
01658           const GeomDetUnit * stereodet=gdet->stereoDet(); 
01659           //      GlobalVector 
01660           gtrkdir=gdet->toGlobal(trackdirection);
01661           LocalVector stereotkdir=stereodet->toLocal(gtrkdir);
01662           if(stereotkdir.z()!=0){
01663             anglealpha = atan(stereotkdir.x()/stereotkdir.z())*180/TMath::Pi();
01664             anglebeta = atan(stereotkdir.y()/stereotkdir.z())*180/TMath::Pi();
01665           }
01666           
01667           if (stereohit)
01668             {
01669               //              cout<<"stereohit from matched hit"<<endl;
01670               isrechitsas = 1;
01671               SiStripRecHit2D::ClusterRef cluster=stereohit->cluster();
01672             
01673               //              const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
01674               const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(stereodet);
01675               const StripTopology &topol=(StripTopology&)stripdet->topology();
01676 
01677               position = stereohit->localPosition();
01678               //  Mposition = topol.measurementPosition(position);
01679               error = stereohit->localPositionError();
01680               Mposition = topol.measurementPosition(position);
01681               Merror = topol.measurementError(position,error);
01682 
01683               //LocalVector drift= driftDirection(stripdet);
01684               LocalVector drift = stripcpe->driftDirection(stripdet);
01685               float thickness=stripdet->surface().bounds().thickness();
01686               rechitsasthickness = thickness;
01687               //cout<<"thickness = "<<thickness<<endl;
01688               float pitch = topol.localPitch(position);
01689               //cout<<"Valid:pitch = "<<pitch<<endl;
01690               float tanalpha = tan(anglealpha/57.3);
01691               //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01692               float tanalphaL = drift.x()/drift.z();
01693               //cout<<"Validstereofrommatched:drift.x() = "<<drift.x()<<endl;
01694               //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
01695               //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01696               Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01697               //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
01698               float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01699               //int nstrips = topol.nstrips(); 
01700               int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01701               int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01702               Wexp = 1+Sp-Sm;
01703 
01704 
01705               clusiz=0;
01706               totcharge=0;
01707               clusiz = cluster->amplitudes().size();
01708               const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01709               for(size_t ia=0; ia<amplitudes.size();ia++){
01710                 totcharge+=amplitudes[ia];
01711               }
01712               rechitsasx = position.x();
01713               rechitsasy = position.y();
01714               rechitsasz = position.z();
01715               rechitsaserrxLF = error.xx();
01716               //              cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
01717               rechitsaserrxMF = Merror.uu();
01718               //              cout<<"rechitsaserrxMF from Matched hit = "<<sqrt(rechitsaserrxMF)<<endl;
01719               clusizsas = clusiz;
01720               cluchgsas = totcharge;
01721 
01722               //Association of the rechit to the simhit
01723               mindist = 999999;
01724               matched.clear();  
01725               matched = associate.associateHit(*stereohit);
01726               if(!matched.empty()){
01727                 //                cout << "\t\t\tmatched  " << matched.size() << endl;
01728                 for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01729                   dist = abs((stereohit)->localPosition().x() - (*m).localPosition().x());
01730                   if(dist<mindist){
01731                     mindist = dist;
01732                     closest = (*m);
01733                   }
01734 
01735                   rechitsasresLF = rechitsasx - closest.localPosition().x();
01736                   rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
01737                   rechitsaspullLF = rechitsasresLF/sqrt(rechitsaserrxLF);
01738                   rechitsaspullMF = rechitsasresMF/sqrt(rechitsaserrxMF);
01739                   
01740 //                cout<<"rechitsasresMF == "<<rechitsasresMF<<endl;
01741 //                cout<<"rechitsaserrxMF == "<<rechitsaserrxMF<<endl;
01742 //                cout<<"rechitsaserrxLF == "<<rechitsaserrxLF<<endl;
01743 //                cout<<"rechitsaspullMF == "<<rechitsaspullMF<<endl;
01744                   
01745                 }
01746               }
01747               rechitsastrackangle = anglealpha;
01748               rechitsastrackanglebeta = anglebeta;
01749               rechitsastrackwidth = Wtrack;
01750               rechitsasexpectedwidth = Wexp;
01751 
01752               clusterWidth = clusiz;
01753               unsigned int iopt;
01754               if (clusterWidth > Wexp + 2) {
01755                 iopt = 1;
01756               } else if (Wexp == 1) {
01757                 iopt = 2;
01758               } else if (clusterWidth <= Wexp) {
01759                 iopt = 3;
01760               } else {
01761                 iopt = 4;
01762               }
01763               rechitsascategory = iopt;
01764             }
01765         }
01766 
01767 
01768       // A VIRER !!!!!!!!!!!!!!!!!!!!
01769 
01770       //    isrechitrphi = 0;
01771       //isrechitsas = 0;
01772       
01773       
01774       if(hit){
01775         // simple hits are mono or stereo
01776         //      cout<<"simple hit"<<endl;
01777         if (StripSubdet.stereo() == 0){
01778           isrechitrphi = 1;
01779           //      cout<<"simple hit mono"<<endl;
01780 
01781           const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
01782           const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
01783           const StripTopology &topol=(StripTopology&)stripdet->topology();
01784 
01785           float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
01786           float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
01787 
01788           SiStripRecHit2D::ClusterRef cluster=hit->cluster();
01789 
01790           position = thit->localPosition();
01791           error = thit->localPositionError();
01792           Mposition = topol.measurementPosition(position);
01793           Merror = topol.measurementError(position,error);
01794 
01795           LocalVector drift = stripcpe->driftDirection(stripdet);
01796           float thickness=stripdet->surface().bounds().thickness();
01797           rechitrphithickness = thickness;
01798           //cout<<"Valid:thickness = "<<thickness<<endl;
01799           float pitch = topol.localPitch(position);
01800           //cout<<"Valid:pitch = "<<pitch<<endl;
01801           float tanalpha = tan(anglealpha/57.3);
01802           //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01803           float tanalphaL = drift.x()/drift.z();
01804           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01805           //      float tanalphaLcpe = driftcpe.x()/driftcpe.z();
01806           //cout<<"Valid:tanalphaLcpe = "<<tanalphaLcpe<<endl;
01807           //cout<<"Validmono:drift.x() = "<<drift.x()<<endl;
01808           //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
01809           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01810           Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01811           //       fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01812           //cout<<"Valid2:Wtrack = "<<Wtrack<<endl;
01813           float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01814           //int nstrips = topol.nstrips(); 
01815           int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01816           int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01817           Wexp = 1+Sp-Sm;
01818 
01819           clusiz=0;
01820           totcharge=0;
01821           clusiz = cluster->amplitudes().size();
01822           //cout<<"cluster->firstStrip() = "<<cluster->firstStrip()<<endl;
01823           const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01824           for(size_t ia=0; ia<amplitudes.size();ia++){
01825             totcharge+=amplitudes[ia];
01826           }
01827           rechitrphix = position.x();
01828           rechitrphiy = position.y();
01829           rechitrphiz = position.z();
01830           rechitrphierrx = error.xx();
01831           rechitrphierrxLF = error.xx();
01832           rechitrphierrxMF = Merror.uu();
01833           //cout<<"rechitrphierrxMF simple hit= "<<sqrt(rechitrphierrxMF)<<endl;
01834           clusizrphi = clusiz;
01835           //cout<<"clusizrphi = "<<clusiz<<endl;
01836           cluchgrphi = totcharge;
01837 
01838           //Association of the rechit to the simhit
01839           mindist = 999999;
01840           matched.clear();  
01841           matched = associate.associateHit(*hit);
01842           if(!matched.empty()){
01843             //            cout << "\t\t\tmatched  " << matched.size() << endl;
01844             for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01845               dist = abs((hit)->localPosition().x() - (*m).localPosition().x());
01846               if(dist<mindist){
01847                 mindist = dist;
01848                 closest = (*m);
01849               }
01850               rechitrphiresLF = rechitrphix - closest.localPosition().x();
01851               rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
01852               rechitrphipullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
01853               rechitrphipullMF = rechitrphiresMF/sqrt(rechitrphierrxMF);
01854             }
01855           }
01856           rechitrphitrackangle = anglealpha;
01857           rechitrphitrackanglebeta = anglebeta;
01858           rechitrphitrackwidth = Wtrack;
01859           rechitrphiexpectedwidth = Wexp;
01860 
01861           clusterWidth = clusiz;
01862           unsigned int iopt;
01863           if (clusterWidth > Wexp + 2) {
01864             iopt = 1;
01865           } else if (Wexp == 1) {
01866             iopt = 2;
01867           } else if (clusterWidth <= Wexp) {
01868             iopt = 3;
01869           } else {
01870             iopt = 4;
01871           }
01872           rechitrphicategory = iopt;
01873           
01874 //        if (rechitrphiexpectedwidth == 1 && clusterWidth == 3) {
01875 //        //if ( clusterWidth == 3) {
01876 //          cout<<"TRUE"<<endl;
01877 //          cout<<"TestClus2:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
01878 //          cout<<"TestClus2:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
01879 //          cout<<"TestClus2:residue = "<<rechitrphiresMF<<endl;
01880 //          short firstStrip = cluster->firstStrip();
01881 //          short lastStrip = firstStrip + clusterWidth - 1;
01882 //          cout<<"TestClus2:firstStrip = "<<firstStrip<<endl;
01883 //          cout<<"TestClus2:lastStrip = "<<lastStrip<<endl;
01884 //          cout<<"TestClus2:detid = "<<detid.subdetId()<<endl;
01885 //          for(size_t ia=0; ia<amplitudes.size();ia++){
01886 //            cout<<"ia, TestClus2:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
01887 //          }
01888 //          cout<<"TestClus2:Trackwidth = "<<Wtrack<<endl;
01889 //        }
01890           
01891         
01892           //cout<<"rechitrphicategory = "<<rechitrphicategory<<endl;
01893 
01894           //      if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
01895             //if ((detid.subdetId() == int(StripSubdetector::TIB))) {
01896            
01897 //          if (clusterWidth ==2 && Wexp == 1 && Wtrack<0.1) {
01898 //            cout<<"TestClus:begin"<<endl;
01899 //            LocalVector  drift2 = drift * fabs(thickness/drift.z());       
01900 //            LocalPoint result2=LocalPoint(position.x()-drift2.x()/2,position.y()-drift2.y()/2,0);
01901 //            MeasurementPoint mpoint=topol.measurementPosition(result2);
01902 //            cout<<"TestClus:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
01903 //            cout<<"TestClus:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
01904 //            cout<<"TestClus:Position RH no drift= "<<thit->localPosition().x() - drift2.x()/2<<" , "<<mpoint.x()<<endl;
01905 //            cout<<"TestClus:Drift= "<<drift.x()<<endl;
01906 //            cout<<"TestClus:residue = "<<rechitrphiresMF<<endl;
01907 //            for(size_t ia=0; ia<amplitudes.size();ia++){
01908 //              cout<<"ia, TestClus:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
01909 //            }
01910 //            cout<<"TestClus:Trackwidth = "<<Wtrack<<endl;
01911 //            short firstStrip = cluster->firstStrip();
01912 //            short lastStrip = firstStrip + clusterWidth - 1;
01913 //            cout<<"TestClus:firstStrip = "<<firstStrip<<endl;
01914 //            cout<<"TestClus:lastStrip = "<<lastStrip<<endl;
01915 //            cout<<"TestClus:detid = "<<detid.subdetId()<<endl;
01916 //            int nstrips = topol.nstrips(); 
01917 //            cout<<"TestClus:nstrips = "<<nstrips<<endl;
01918 //            cout<<"TestClus:anglealpha = "<<anglealpha<<endl;
01919 //            cout<<"TestClus:end"<<endl;
01920 //            positionshx = (topol.measurementPosition(closest.localPosition())).x();
01921 
01922 //            if ((positionshx - int(positionshx)) > 0.5) {
01923 //              if (lastStrip > int(positionshx)) secondstrip = 1;
01924 //              if (lastStrip = int(positionshx)) secondstrip = -1;
01925 //            }
01926 //            if ((positionshx - int(positionshx)) < 0.5) {
01927 //              if (lastStrip > int(positionshx)) secondstrip = -1;
01928 //              if (lastStrip = int(positionshx)) secondstrip = 1;
01929 //            }
01930 
01931 //          }
01932 
01933             //}
01934           
01935 //        cout<<"int() = "<<int((topol.measurementPosition(closest.localPosition())).x())<<endl;
01936 //        diff = int((topol.measurementPosition(closest.localPosition())).x()) -topol.measurementPosition(closest.localPosition()).x();
01937 //        cout<<"diff = "<<diff<<endl;
01938 //        if (clusterWidth ==2 && Wexp == 1 && Wtrack<1) {
01939 //          if ((abs(1 + diff) <0.2) || (abs(diff) <0.2)) {
01940 //            //              isrechitrphi = 0;
01941 //            cout<<"vire"<<endl;
01942 //          }
01943 //        }
01944 //        positionshx = (topol.measurementPosition(closest.localPosition())).x();
01945 
01946 
01947         }
01948 
01949         if (StripSubdet.stereo() == 1){
01950 
01951           //cout<<"simple hit stereo"<<endl;
01952           isrechitsas = 1;
01953 
01954           const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
01955           const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
01956           const StripTopology &topol=(StripTopology&)stripdet->topology();
01957 
01958           float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
01959           float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
01960 
01961           SiStripRecHit2D::ClusterRef cluster=hit->cluster();
01962 
01963 
01964           position = thit->localPosition();
01965           error = thit->localPositionError();
01966           Mposition = topol.measurementPosition(position);
01967           Merror = topol.measurementError(position,error);
01968 
01969           //      LocalVector drift= driftDirection(stripdet);
01970           LocalVector drift = stripcpe->driftDirection(stripdet);
01971           float thickness=stripdet->surface().bounds().thickness();
01972           rechitsasthickness = thickness;
01973           //cout<<"thickness = "<<thickness<<endl;
01974           float pitch = topol.localPitch(position);
01975           //cout<<"Valid:pitch = "<<pitch<<endl;
01976           float tanalpha = tan(anglealpha/57.3);
01977           //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01978           float tanalphaL = drift.x()/drift.z();
01979           //cout<<"Validstereo:drift.x() = "<<drift.x()<<endl;
01980           //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
01981           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01982           Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01983           //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
01984           float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01985           //int nstrips = topol.nstrips(); 
01986           int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01987           int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01988           Wexp = 1+Sp-Sm;
01989 
01990           clusiz=0;
01991           totcharge=0;
01992           clusiz = cluster->amplitudes().size();
01993           const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01994           for(size_t ia=0; ia<amplitudes.size();ia++){
01995             totcharge+=amplitudes[ia];
01996           }
01997           rechitsasx = position.x();
01998           rechitsasy = position.y();
01999           rechitsasz = position.z();
02000           rechitsaserrxLF = error.xx();
02001           //cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
02002           rechitsaserrxMF = Merror.uu();
02003           //cout<<"rechitsaserrxMF simple hit= "<<sqrt(rechitsaserrxMF)<<endl;
02004           clusizsas = clusiz;
02005           cluchgsas = totcharge;
02006 
02007           //Association of the rechit to the simhit
02008           mindist = 999999;
02009           matched.clear();  
02010           matched = associate.associateHit(*hit);
02011           if(!matched.empty()){
02012             //            cout << "\t\t\tmatched  " << matched.size() << endl;
02013             for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
02014               dist = abs((hit)->localPosition().x() - (*m).localPosition().x());
02015               if(dist<mindist){
02016                 mindist = dist;
02017                 closest = (*m);
02018               }
02019 
02020               rechitsasresLF = rechitsasx - closest.localPosition().x();
02021               rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
02022               rechitsaspullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
02023               rechitsaspullMF = rechitsasresMF/sqrt(rechitsaserrxMF);
02024 
02025             }
02026           }
02027           rechitsastrackangle = anglealpha;
02028           rechitsastrackanglebeta = anglebeta;
02029           rechitsastrackwidth = Wtrack;
02030           rechitsasexpectedwidth = Wexp;
02031 
02032           clusterWidth = clusiz;
02033           unsigned int iopt;
02034           if (clusterWidth > Wexp + 2) {
02035             iopt = 1;
02036           } else if (Wexp == 1) {
02037             iopt = 2;
02038           } else if (clusterWidth <= Wexp) {
02039             iopt = 3;
02040           } else {
02041             iopt = 4;
02042           }
02043           rechitsascategory = iopt;
02044         }
02045         //isrechitsas = 0;
02046       }
02047       
02048 
02049       //Filling Histograms for simple hits
02050       //cout<<"isrechitrphi,isrechitsas = "<<isrechitrphi<<","<<isrechitsas<<endl;
02051 
02052       float CutThickness=0.04;
02053       CutThickness=0.;
02054 
02055       if(isrechitrphi>0 || isrechitsas>0){
02056 
02057         
02058         if (isrechitrphi>0) {
02059           
02060           //cout<<"rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02061           /*
02062           if (rechitrphithickness > CutThickness)
02063             {
02064                       PullvsTrackwidth->Fill(rechitrphitrackwidth,rechitrphipullMF);
02065                       
02066               if (clusizrphi ==2 && rechitrphiexpectedwidth == 1 && rechitrphitrackwidth<0.1) {
02067                 //Diff->Fill(-diff);
02068 
02069                 //              if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
02070                 //SecondStrip->Fill(secondstrip);
02071                 //              }
02072               }
02073               //              Diff->Fill(-diff);
02074               
02075               //PositionSHx->Fill(positionshx);
02076 
02077               //    ErrxMF->Fill(sqrt(rechitrphierrxMF));
02078               //cout<<"ICI1:rechitrphitrackwidth = "<<rechitrphitrackwidth<<endl;
02079               //ErrxMFvsTrackwidth->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02080               ResMFvsTrackwidth->Fill(rechitrphitrackwidth,rechitrphiresMF);
02081               
02082               PullvsClusterwidth->Fill(clusizrphi,rechitrphipullMF);
02083               PullvsExpectedwidth->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02084               PullvsTrackangle->Fill(rechitrphitrackangle,rechitrphipullMF);
02085               PullvsTrackanglebeta->Fill(rechitrphitrackanglebeta,rechitrphipullMF);
02086              
02087             }
02088           */
02089           
02090           meCategory->Fill(rechitrphicategory);
02091           meTrackwidth->Fill(rechitrphitrackwidth);
02092           meExpectedwidth->Fill(rechitrphiexpectedwidth);
02093           meClusterwidth->Fill(clusizrphi);
02094           meTrackanglealpha->Fill(rechitrphitrackangle);
02095           meTrackanglebeta->Fill(rechitrphitrackanglebeta);
02096 
02097           meErrxMFAngleProfile->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02098           meErrxMFTrackwidthProfile->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02099 
02100           if (clusizrphi == 1) {
02101             meErrxMFTrackwidthProfileWClus1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02102             meResMFTrackwidthProfileWClus1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02103             if (rechitrphithickness > CutThickness)
02104               {
02105                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02106                 //{
02107                 /*
02108                 ResMFvsTrackwidthWClus1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02109                     if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus1Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02110                     if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus1Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02111                     if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus1Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02112                     if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus1Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02113                     ErrxMFvsTrackwidthWClus1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02114                 */
02115                     //}
02116               }
02117           }
02118           if (clusizrphi == 2) {
02119             meErrxMFTrackwidthProfileWClus2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02120             meResMFTrackwidthProfileWClus2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02121             meResMFTrackwidthProfileWClus21->Fill(rechitrphitrackwidth,rechitrphiresMF);
02122             meResMFTrackwidthProfileWClus22->Fill(rechitrphitrackwidth,rechitrphiresMF);
02123             meResMFTrackwidthProfileWClus23->Fill(rechitrphitrackwidth,rechitrphiresMF);
02124             if (rechitrphithickness > CutThickness)
02125               {
02126                 //              if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02127                 //{
02128                 if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))){
02129                   /*    ResMFvsTrackwidthWClus2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02130                 if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus2Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02131                 if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus2Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02132                 if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus2Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02133                 if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus2Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);*/
02134                 }
02135                 //          meResMFTrackwidthProfileWClus22->Fill(rechitrphitrackwidth,rechitrphiresMF);
02136                 //cout<<"ICI2:rechitrphitrackwidth = "<<rechitrphitrackwidth<<endl;
02137 
02138                 //ErrxMFvsTrackwidthWClus2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02139                     // }
02140               }
02141           }
02142           if (clusizrphi == 3) {
02143             meErrxMFTrackwidthProfileWClus3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02144             meResMFTrackwidthProfileWClus3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02145             if (rechitrphithickness > CutThickness)
02146               {
02147                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02148                 //{
02149                 /*
02150                 ResMFvsTrackwidthWClus3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02151                 if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus3Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02152                 if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus3Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02153                 if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus3Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02154                 if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus3Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02155                 ErrxMFvsTrackwidthWClus3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02156                 */
02157                 //  }
02158               }
02159           }
02160           if (clusizrphi == 4) {
02161             meErrxMFTrackwidthProfileWClus4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02162             meResMFTrackwidthProfileWClus4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02163             if (rechitrphithickness > CutThickness)
02164               {
02165                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02166                 //{
02167                 /*      ResMFvsTrackwidthWClus4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02168                 if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus4Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02169                 if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus4Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02170                 if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus4Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02171                 if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus4Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02172                 ErrxMFvsTrackwidthWClus4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));*/
02173                     //}
02174               }
02175           }
02176           
02177           if (rechitrphicategory == 1) {
02178             meErrxMFTrackwidthProfileCategory1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02179             meErrxMFClusterwidthProfileCategory1->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02180           }
02181           if (rechitrphicategory == 2) {
02182             meErrxMFTrackwidthProfileCategory2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02183             //ResMFvsTrackwidthCategory2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02184             //  ErrxMFvsTrackwidthCategory2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02185           }
02186           if (rechitrphicategory == 3) {
02187             meErrxMFTrackwidthProfileCategory3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02188             //ResMFvsTrackwidthCategory3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02189             //ErrxMFvsTrackwidthCategory3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02190           }
02191           if (rechitrphicategory == 4) {
02192             meErrxMFTrackwidthProfileCategory4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02193             //ResMFvsTrackwidthCategory4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02194             //ErrxMFvsTrackwidthCategory4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02195           }
02196           //const unsigned int NBINS = meErrxMFTrackwidthProfile->getNbinsX();
02197           //cout<<"NBINS2 = "<<NBINS<<endl;
02198           
02199           meErrxMF->Fill(sqrt(rechitrphierrxMF));
02200           //const unsigned int NBINS3 = meErrxMF->getNbinsX();
02201           //cout<<"NBINS3 = "<<NBINS<<endl;
02202           meErrxLF->Fill(sqrt(rechitrphierrxLF));
02203           meResMF->Fill(rechitrphiresMF);
02204           meResLF->Fill(rechitrphiresLF);
02205           mePullMF->Fill(rechitrphipullMF);
02206           mePullLF->Fill(rechitrphipullLF);
02207           
02208         }
02209 
02210         if (isrechitsas>0) {
02211           
02212           if (rechitsasthickness > CutThickness)
02213             {
02214               /*
02215                       PullvsTrackwidth->Fill(rechitsastrackwidth,rechitsaspullMF);
02216                       //cout<<"rechitsaserrxMF"<<rechitsaserrxMF<<endl;
02217                       // ErrxMF->Fill(sqrt(rechitsaserrxMF));
02218               ErrxMFvsTrackwidth->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02219               ResMFvsTrackwidth->Fill(rechitsastrackwidth,rechitsasresMF);
02220 
02221               
02222               PullvsClusterwidth->Fill(clusizsas,rechitsaspullMF);
02223               PullvsExpectedwidth->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02224               PullvsTrackangle->Fill(rechitsastrackangle,rechitsaspullMF);
02225               PullvsTrackanglebeta->Fill(rechitsastrackanglebeta,rechitsaspullMF);
02226               */
02227             }
02228           
02229           
02230           meCategory->Fill(rechitsascategory);
02231           meTrackwidth->Fill(rechitsastrackwidth);
02232           meExpectedwidth->Fill(rechitsasexpectedwidth);
02233           meClusterwidth->Fill(clusizsas);
02234           meTrackanglealpha->Fill(rechitsastrackangle);
02235           meTrackanglebeta->Fill(rechitsastrackanglebeta);
02236           
02237           meErrxMFAngleProfile->Fill(rechitsastrackangle,sqrt(rechitsaserrxMF));
02238           meErrxMFTrackwidthProfile->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02239           
02240           if (clusizsas == 1) {
02241             meErrxMFTrackwidthProfileWClus1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02242             meResMFTrackwidthProfileWClus1->Fill(rechitsastrackwidth,rechitsasresMF);
02243             if (rechitsasthickness > CutThickness)
02244               {
02245                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02246                 //{
02247                 /*  
02248                 ResMFvsTrackwidthWClus1->Fill(rechitsastrackwidth,rechitsasresMF);
02249                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus1Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02250                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus1Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02251                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus1Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02252                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus1Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02253                 ErrxMFvsTrackwidthWClus1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02254                 */
02255                        //}
02256               }
02257           }
02258           
02259           if (clusizsas == 2) {
02260             meErrxMFTrackwidthProfileWClus2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02261             meResMFTrackwidthProfileWClus2->Fill(rechitsastrackwidth,rechitsasresMF);
02262             if (rechitsasthickness > CutThickness)
02263               {
02264                 //              if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02265                 //{
02266                 /*
02267                 ResMFvsTrackwidthWClus2->Fill(rechitsastrackwidth,rechitsasresMF);
02268                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus2Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02269                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus2Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02270                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus2Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02271                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus2Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02272                 ErrxMFvsTrackwidthWClus2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02273                 */
02274                     //}
02275               }
02276           }
02277           if (clusizsas == 3) {
02278             meErrxMFTrackwidthProfileWClus3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02279             meResMFTrackwidthProfileWClus3->Fill(rechitsastrackwidth,rechitsasresMF);
02280             if (rechitsasthickness > CutThickness)
02281               {
02282                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02283                 // {
02284                 /*
02285                 ResMFvsTrackwidthWClus3->Fill(rechitsastrackwidth,rechitsasresMF);
02286                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus3Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02287                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus3Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02288                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus3Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02289                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus3Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02290                 ErrxMFvsTrackwidthWClus3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02291                 */
02292                 //}
02293               }
02294           }
02295           if (clusizsas == 4) {
02296             meErrxMFTrackwidthProfileWClus4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02297             meResMFTrackwidthProfileWClus4->Fill(rechitsastrackwidth,rechitsasresMF);
02298             if (rechitsasthickness > CutThickness)
02299               {
02300                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02301                 //{
02302                 /*
02303                 ResMFvsTrackwidthWClus4->Fill(rechitsastrackwidth,rechitsasresMF);
02304                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus4Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02305                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus4Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02306                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus4Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02307                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus4Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02308                 ErrxMFvsTrackwidthWClus4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02309                 */
02310                     // }
02311               }
02312           }
02313           if (rechitsascategory == 1) {
02314             meErrxMFTrackwidthProfileCategory1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02315             meErrxMFClusterwidthProfileCategory1->Fill(clusizsas,sqrt(rechitsaserrxMF));
02316           }
02317           if (rechitsascategory == 2) {
02318             meErrxMFTrackwidthProfileCategory2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02319             //ResMFvsTrackwidthCategory2->Fill(rechitsastrackwidth,rechitsasresMF);
02320             //ErrxMFvsTrackwidthCategory2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02321           }
02322           if (rechitsascategory == 3) {
02323             meErrxMFTrackwidthProfileCategory3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02324             //ResMFvsTrackwidthCategory3->Fill(rechitsastrackwidth,rechitsasresMF);
02325             //ErrxMFvsTrackwidthCategory3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02326           }
02327           if (rechitsascategory == 4) {
02328             meErrxMFTrackwidthProfileCategory4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02329             //ResMFvsTrackwidthCategory4->Fill(rechitsastrackwidth,rechitsasresMF);
02330             //ErrxMFvsTrackwidthCategory4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02331           }
02332           
02333           meErrxMF->Fill(sqrt(rechitsaserrxMF));
02334           meErrxLF->Fill(sqrt(rechitsaserrxLF));
02335           meResMF->Fill(rechitsasresMF);
02336           meResLF->Fill(rechitsasresLF);
02337           mePullMF->Fill(rechitsaspullMF);
02338           mePullLF->Fill(rechitsaspullLF);
02339            
02340         }
02341 
02342         
02343         if (detid.subdetId() == int(StripSubdetector::TIB)){
02344           TIBDetId tibid(myid);
02345           int Tibisrechitrphi    = isrechitrphi;
02346           int Tibisrechitsas     = isrechitsas;
02347           //cout<<"Tibisrechitrphi,Tibisrechitsas = "<<Tibisrechitrphi<<" "<<Tibisrechitsas<<endl;
02348           int ilay = tibid.layer() - 1; //for histogram filling
02349           //cout<<"ilay1 = "<<ilay<<endl;
02350           if(Tibisrechitrphi!=0){
02351             if (rechitrphithickness > CutThickness)
02352               {
02353                 /*PullvsTrackwidthTIB->Fill(rechitrphitrackwidth,rechitrphipullMF);
02354                 PullvsClusterwidthTIB->Fill(clusizrphi,rechitrphipullMF);
02355                 PullvsExpectedwidthTIB->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02356                 PullvsTrackangleTIB->Fill(rechitrphitrackangle,rechitrphipullMF);
02357                 PullvsTrackanglebetaTIB->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02358               }
02359             //cout<<"TIB:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02360             //cout<<"ilay2 = "<<ilay<<endl;
02361             //cout<<"je suis la RPHI"<<endl;
02362             meNstpRphiTIB[ilay]->Fill(clusizrphi);
02363             meAdcRphiTIB[ilay]->Fill(cluchgrphi);
02364             mePosxRphiTIB[ilay]->Fill(rechitrphix);
02365             meErrxLFRphiTIB[ilay]->Fill(sqrt(rechitrphierrxLF));
02366             meErrxMFRphiTIB[ilay]->Fill(sqrt(rechitrphierrxMF));
02367             meResLFRphiTIB[ilay]->Fill(rechitrphiresLF);
02368             meResMFRphiTIB[ilay]->Fill(rechitrphiresMF);
02369             mePullLFRphiTIB[ilay]->Fill(rechitrphipullLF);
02370             mePullMFRphiTIB[ilay]->Fill(rechitrphipullMF);
02371             meTrackangleRphiTIB[ilay]->Fill(rechitrphitrackangle);
02372             mePullTrackangleProfileRphiTIB[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02373             mePullTrackwidthProfileRphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02374             if (clusizrphi == 1) {
02375               meErrxMFTrackwidthProfileWclus1RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02376               meResMFTrackwidthProfileWclus1RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02377             }
02378             if (clusizrphi == 2) {
02379               meErrxMFTrackwidthProfileWclus2RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02380               meResMFTrackwidthProfileWclus2RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02381             }
02382             if (clusizrphi == 3) {
02383               meErrxMFTrackwidthProfileWclus3RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02384               meResMFTrackwidthProfileWclus3RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02385             }
02386             if (clusizrphi == 4) {
02387               meErrxMFTrackwidthProfileWclus4RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02388               meResMFTrackwidthProfileWclus4RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02389             }
02390 
02391 
02392             if (rechitrphicategory == 1) {
02393               mePullTrackwidthProfileCategory1RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02394               meErrxMFTrackwidthProfileCategory1RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02395               meErrxMFClusterwidthProfileCategory1RphiTIB[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02396             }
02397             if (rechitrphicategory == 2) {
02398               mePullTrackwidthProfileCategory2RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02399               meErrxMFTrackwidthProfileCategory2RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02400             }
02401             if (rechitrphicategory == 3) {
02402               mePullTrackwidthProfileCategory3RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02403               meErrxMFTrackwidthProfileCategory3RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02404             }
02405             if (rechitrphicategory == 4) {
02406               mePullTrackwidthProfileCategory4RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02407               meErrxMFTrackwidthProfileCategory4RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02408             }
02409             meTrackwidthRphiTIB[ilay]->Fill(rechitrphitrackwidth);
02410             meExpectedwidthRphiTIB[ilay]->Fill(rechitrphiexpectedwidth);
02411             meClusterwidthRphiTIB[ilay]->Fill(clusizrphi);
02412             meCategoryRphiTIB[ilay]->Fill(rechitrphicategory);
02413             meErrxMFTrackwidthProfileRphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02414             meErrxMFAngleProfileRphiTIB[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02415           }
02416           if(Tibisrechitsas!=0){
02417             if (rechitsasthickness > CutThickness)
02418               {
02419                 /*      PullvsTrackwidthTIB->Fill(rechitsastrackwidth,rechitsaspullMF);
02420                 PullvsClusterwidthTIB->Fill(clusizsas,rechitsaspullMF);
02421                 PullvsExpectedwidthTIB->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02422                 PullvsTrackangleTIB->Fill(rechitsastrackangle,rechitsaspullMF);
02423                 PullvsTrackanglebetaTIB->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
02424               }
02425             meNstpSasTIB[ilay]->Fill(clusizsas);
02426             meAdcSasTIB[ilay]->Fill(cluchgsas);
02427             mePosxSasTIB[ilay]->Fill(rechitsasx);
02428             meErrxLFSasTIB[ilay]->Fill(sqrt(rechitsaserrxLF));
02429             meResLFSasTIB[ilay]->Fill(rechitsasresLF);
02430             mePullLFSasTIB[ilay]->Fill(rechitsaspullLF);
02431             meErrxMFSasTIB[ilay]->Fill(sqrt(rechitsaserrxMF));
02432             meResMFSasTIB[ilay]->Fill(rechitsasresMF);
02433             mePullMFSasTIB[ilay]->Fill(rechitsaspullMF);
02434             meTrackangleSasTIB[ilay]->Fill(rechitsastrackangle);
02435             mePullTrackangleProfileSasTIB[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02436             mePullTrackwidthProfileSasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02437             if (rechitsascategory == 1) {
02438               mePullTrackwidthProfileCategory1SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02439               meErrxMFTrackwidthProfileCategory1SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02440               meErrxMFClusterwidthProfileCategory1SasTIB[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02441             }
02442             if (rechitsascategory == 2) {
02443               mePullTrackwidthProfileCategory2SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02444               meErrxMFTrackwidthProfileCategory2SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02445             }
02446             if (rechitsascategory == 3) {
02447               mePullTrackwidthProfileCategory3SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02448               meErrxMFTrackwidthProfileCategory3SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02449             }
02450             if (rechitsascategory == 4) {
02451               mePullTrackwidthProfileCategory4SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02452               meErrxMFTrackwidthProfileCategory4SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02453             }
02454             meTrackwidthSasTIB[ilay]->Fill(rechitsastrackwidth);
02455             meExpectedwidthSasTIB[ilay]->Fill(rechitsasexpectedwidth);
02456             meClusterwidthSasTIB[ilay]->Fill(clusizsas);
02457             meCategorySasTIB[ilay]->Fill(rechitsascategory);
02458             meErrxMFTrackwidthProfileSasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02459             meErrxMFAngleProfileSasTIB[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02460           }
02461         }
02462         
02463         if (detid.subdetId() == int(StripSubdetector::TOB)){
02464           TOBDetId tobid(myid);
02465           int Tobisrechitrphi    = isrechitrphi;
02466           int Tobisrechitsas     = isrechitsas;
02467           int ilay = tobid.layer() - 1; //for histogram filling
02468           if(Tobisrechitrphi!=0){
02469             if (rechitrphithickness > CutThickness)
02470               {
02471                 /*PullvsTrackwidthTOB->Fill(rechitrphitrackwidth,rechitrphipullMF);
02472                 PullvsClusterwidthTOB->Fill(clusizrphi,rechitrphipullMF);
02473                 PullvsExpectedwidthTOB->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02474                 PullvsTrackangleTOB->Fill(rechitrphitrackangle,rechitrphipullMF);
02475                 PullvsTrackanglebetaTOB->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02476               }
02477             //cout<<"TOB:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02478             meNstpRphiTOB[ilay]->Fill(clusizrphi);
02479             meAdcRphiTOB[ilay]->Fill(cluchgrphi);
02480             mePosxRphiTOB[ilay]->Fill(rechitrphix);
02481             meErrxLFRphiTOB[ilay]->Fill(sqrt(rechitrphierrxLF));
02482             meResLFRphiTOB[ilay]->Fill(rechitrphiresLF);
02483             mePullLFRphiTOB[ilay]->Fill(rechitrphipullLF);
02484             meErrxMFRphiTOB[ilay]->Fill(sqrt(rechitrphierrxMF));
02485             meResMFRphiTOB[ilay]->Fill(rechitrphiresMF);
02486             mePullMFRphiTOB[ilay]->Fill(rechitrphipullMF);
02487             meTrackangleRphiTOB[ilay]->Fill(rechitrphitrackangle);
02488             mePullTrackangleProfileRphiTOB[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02489             mePullTrackwidthProfileRphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02490 
02491             if (clusizrphi == 1) {
02492               meErrxMFTrackwidthProfileWclus1RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02493               meResMFTrackwidthProfileWclus1RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02494             }
02495             if (clusizrphi == 2) {
02496               meErrxMFTrackwidthProfileWclus2RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02497               meResMFTrackwidthProfileWclus2RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02498             }
02499             if (clusizrphi == 3) {
02500               meErrxMFTrackwidthProfileWclus3RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02501               meResMFTrackwidthProfileWclus3RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02502             }
02503             if (clusizrphi == 4) {
02504               meErrxMFTrackwidthProfileWclus4RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02505               meResMFTrackwidthProfileWclus4RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02506             }
02507 
02508 
02509             if (rechitrphicategory == 1) {
02510               mePullTrackwidthProfileCategory1RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02511               meErrxMFTrackwidthProfileCategory1RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02512               meErrxMFClusterwidthProfileCategory1RphiTOB[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02513             }
02514             if (rechitrphicategory == 2) {
02515               mePullTrackwidthProfileCategory2RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02516               meErrxMFTrackwidthProfileCategory2RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02517             }
02518             if (rechitrphicategory == 3) {
02519               mePullTrackwidthProfileCategory3RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02520               meErrxMFTrackwidthProfileCategory3RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02521             }
02522             if (rechitrphicategory == 4) {
02523               mePullTrackwidthProfileCategory4RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02524               meErrxMFTrackwidthProfileCategory4RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02525             }
02526             meTrackwidthRphiTOB[ilay]->Fill(rechitrphitrackwidth);
02527             meExpectedwidthRphiTOB[ilay]->Fill(rechitrphiexpectedwidth);
02528             meClusterwidthRphiTOB[ilay]->Fill(clusizrphi);
02529             meCategoryRphiTOB[ilay]->Fill(rechitrphicategory);
02530             meErrxMFTrackwidthProfileRphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02531             meErrxMFAngleProfileRphiTOB[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02532           } 
02533           if(Tobisrechitsas!=0){
02534             if (rechitsasthickness > CutThickness)
02535               {/*
02536                 PullvsTrackwidthTOB->Fill(rechitsastrackwidth,rechitsaspullMF);
02537                 PullvsClusterwidthTOB->Fill(clusizsas,rechitsaspullMF);
02538                 PullvsExpectedwidthTOB->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02539                 PullvsTrackangleTOB->Fill(rechitsastrackangle,rechitsaspullMF);
02540                 PullvsTrackanglebetaTOB->Fill(rechitsastrackanglebeta,rechitsaspullMF);
02541                */
02542               }
02543             meNstpSasTOB[ilay]->Fill(clusizsas);
02544             meAdcSasTOB[ilay]->Fill(cluchgsas);
02545             mePosxSasTOB[ilay]->Fill(rechitsasx);
02546             meErrxLFSasTOB[ilay]->Fill(sqrt(rechitsaserrxLF));
02547             meResLFSasTOB[ilay]->Fill(rechitsasresLF);
02548             mePullLFSasTOB[ilay]->Fill(rechitsaspullLF);
02549             meErrxMFSasTOB[ilay]->Fill(sqrt(rechitsaserrxMF));
02550             meResMFSasTOB[ilay]->Fill(rechitsasresMF);
02551             mePullMFSasTOB[ilay]->Fill(rechitsaspullMF);
02552             meTrackangleSasTOB[ilay]->Fill(rechitsastrackangle);
02553             mePullTrackangleProfileSasTOB[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02554             mePullTrackwidthProfileSasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02555             if (rechitsascategory == 1) {
02556               mePullTrackwidthProfileCategory1SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02557               meErrxMFTrackwidthProfileCategory1SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02558               meErrxMFClusterwidthProfileCategory1SasTOB[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02559             }
02560             if (rechitsascategory == 2) {
02561               mePullTrackwidthProfileCategory2SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02562               meErrxMFTrackwidthProfileCategory2SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02563             }
02564             if (rechitsascategory == 3) {
02565               mePullTrackwidthProfileCategory3SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02566               meErrxMFTrackwidthProfileCategory3SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02567             }
02568             if (rechitsascategory == 4) {
02569               mePullTrackwidthProfileCategory4SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02570               meErrxMFTrackwidthProfileCategory4SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02571             }
02572             meTrackwidthSasTOB[ilay]->Fill(rechitsastrackwidth);
02573             meExpectedwidthSasTOB[ilay]->Fill(rechitsasexpectedwidth);
02574             meClusterwidthSasTOB[ilay]->Fill(clusizsas);
02575             meCategorySasTOB[ilay]->Fill(rechitsascategory);
02576             meErrxMFTrackwidthProfileSasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02577             meErrxMFAngleProfileSasTOB[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02578           }
02579         }
02580         
02581         if (detid.subdetId() == int(StripSubdetector::TID)){
02582           TIDDetId tidid(myid);
02583           int Tidisrechitrphi    = isrechitrphi;
02584           int Tidisrechitsas     = isrechitsas;
02585           int ilay = tidid.ring() - 1; //for histogram filling
02586           if(Tidisrechitrphi!=0){
02587             if (rechitrphithickness > CutThickness)
02588               {
02589                 /*PullvsTrackwidthTID->Fill(rechitrphitrackwidth,rechitrphipullMF);
02590                 PullvsClusterwidthTID->Fill(clusizrphi,rechitrphipullMF);
02591                 PullvsExpectedwidthTID->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02592                 PullvsTrackangleTID->Fill(rechitrphitrackangle,rechitrphipullMF);
02593                 PullvsTrackanglebetaTID->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02594               }
02595             //cout<<"TID:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02596             meNstpRphiTID[ilay]->Fill(clusizrphi);
02597             meAdcRphiTID[ilay]->Fill(cluchgrphi);
02598             mePosxRphiTID[ilay]->Fill(rechitrphix);
02599             meErrxLFRphiTID[ilay]->Fill(sqrt(rechitrphierrxLF));
02600             meResLFRphiTID[ilay]->Fill(rechitrphiresLF);
02601             mePullLFRphiTID[ilay]->Fill(rechitrphipullLF);
02602             meErrxMFRphiTID[ilay]->Fill(sqrt(rechitrphierrxMF));
02603             meResMFRphiTID[ilay]->Fill(rechitrphiresMF);
02604             mePullMFRphiTID[ilay]->Fill(rechitrphipullMF);
02605             meTrackangleRphiTID[ilay]->Fill(rechitrphitrackangle);
02606             mePullTrackangleProfileRphiTID[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02607             mePullTrackwidthProfileRphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02608             if (rechitrphicategory == 1) {
02609               mePullTrackwidthProfileCategory1RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02610               meErrxMFTrackwidthProfileCategory1RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02611               meErrxMFClusterwidthProfileCategory1RphiTID[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02612             }
02613             if (rechitrphicategory == 2) {
02614               mePullTrackwidthProfileCategory2RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02615               meErrxMFTrackwidthProfileCategory2RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02616             }
02617             if (rechitrphicategory == 3) {
02618               mePullTrackwidthProfileCategory3RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02619               meErrxMFTrackwidthProfileCategory3RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02620             }
02621             if (rechitrphicategory == 4) {
02622               mePullTrackwidthProfileCategory4RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02623               meErrxMFTrackwidthProfileCategory4RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02624             }
02625             meTrackwidthRphiTID[ilay]->Fill(rechitrphitrackwidth);
02626             meExpectedwidthRphiTID[ilay]->Fill(rechitrphiexpectedwidth);
02627             meClusterwidthRphiTID[ilay]->Fill(clusizrphi);
02628             meCategoryRphiTID[ilay]->Fill(rechitrphicategory);
02629             meErrxMFTrackwidthProfileRphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02630             meErrxMFAngleProfileRphiTID[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02631           } 
02632           if(Tidisrechitsas!=0){
02633             if (rechitsasthickness > CutThickness)
02634               {
02635                 /*PullvsTrackwidthTID->Fill(rechitsastrackwidth,rechitsaspullMF);
02636                 PullvsClusterwidthTID->Fill(clusizsas,rechitsaspullMF);
02637                 PullvsExpectedwidthTID->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02638                 PullvsTrackangleTID->Fill(rechitsastrackangle,rechitsaspullMF);
02639                 PullvsTrackanglebetaTID->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
02640               }
02641             meNstpSasTID[ilay]->Fill(clusizsas);
02642             meAdcSasTID[ilay]->Fill(cluchgsas);
02643             mePosxSasTID[ilay]->Fill(rechitsasx);
02644             meErrxLFSasTID[ilay]->Fill(sqrt(rechitsaserrxLF));
02645             meResLFSasTID[ilay]->Fill(rechitsasresLF);
02646             mePullLFSasTID[ilay]->Fill(rechitsaspullLF);
02647             meErrxMFSasTID[ilay]->Fill(sqrt(rechitsaserrxMF));
02648             meResMFSasTID[ilay]->Fill(rechitsasresMF);
02649             mePullMFSasTID[ilay]->Fill(rechitsaspullMF);
02650             meTrackangleSasTID[ilay]->Fill(rechitsastrackangle);
02651             mePullTrackangleProfileSasTID[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02652             mePullTrackwidthProfileSasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02653             if (rechitsascategory == 1) {
02654               mePullTrackwidthProfileCategory1SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02655               meErrxMFTrackwidthProfileCategory1SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02656               meErrxMFClusterwidthProfileCategory1SasTID[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02657             }
02658             if (rechitsascategory == 2) {
02659               mePullTrackwidthProfileCategory2SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02660               meErrxMFTrackwidthProfileCategory2SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02661             }
02662             if (rechitsascategory == 3) {
02663               mePullTrackwidthProfileCategory3SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02664               meErrxMFTrackwidthProfileCategory3SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02665             }
02666             if (rechitsascategory == 4) {
02667               mePullTrackwidthProfileCategory4SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02668               meErrxMFTrackwidthProfileCategory4SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02669             }
02670             meTrackwidthSasTID[ilay]->Fill(rechitsastrackwidth);
02671             meExpectedwidthSasTID[ilay]->Fill(rechitsasexpectedwidth);
02672             meClusterwidthSasTID[ilay]->Fill(clusizsas);
02673             meCategorySasTID[ilay]->Fill(rechitsascategory);
02674             meErrxMFTrackwidthProfileSasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02675             meErrxMFAngleProfileSasTID[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02676           }
02677         }
02678               
02679         if (detid.subdetId() == int(StripSubdetector::TEC)){
02680           TECDetId tecid(myid);
02681           int Tecisrechitrphi    = isrechitrphi;
02682           int Tecisrechitsas     = isrechitsas;
02683           int ilay = tecid.ring() - 1; //for histogram filling
02684           if(Tecisrechitrphi!=0){
02685             if (rechitrphithickness > CutThickness)
02686               {
02687                 /*PullvsTrackwidthTEC->Fill(rechitrphitrackwidth,rechitrphipullMF);
02688                 PullvsClusterwidthTEC->Fill(clusizrphi,rechitrphipullMF);
02689                 PullvsExpectedwidthTEC->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02690                 PullvsTrackangleTEC->Fill(rechitrphitrackangle,rechitrphipullMF);
02691                 PullvsTrackanglebetaTEC->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02692               }
02693             //cout<<"TEC:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02694             meNstpRphiTEC[ilay]->Fill(clusizrphi);
02695             meAdcRphiTEC[ilay]->Fill(cluchgrphi);
02696             mePosxRphiTEC[ilay]->Fill(rechitrphix);
02697             meErrxLFRphiTEC[ilay]->Fill(sqrt(rechitrphierrxLF));
02698             meResLFRphiTEC[ilay]->Fill(rechitrphiresLF);
02699             mePullLFRphiTEC[ilay]->Fill(rechitrphipullLF);
02700             meErrxMFRphiTEC[ilay]->Fill(sqrt(rechitrphierrxMF));
02701             meResMFRphiTEC[ilay]->Fill(rechitrphiresMF);
02702             mePullMFRphiTEC[ilay]->Fill(rechitrphipullMF);
02703             meTrackangleRphiTEC[ilay]->Fill(rechitrphitrackangle);
02704             mePullTrackangleProfileRphiTEC[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02705             mePullTrackwidthProfileRphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02706             if (rechitrphicategory == 1) {
02707               mePullTrackwidthProfileCategory1RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02708               meErrxMFTrackwidthProfileCategory1RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02709               meErrxMFClusterwidthProfileCategory1RphiTEC[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02710             }
02711             if (rechitrphicategory == 2) {
02712               mePullTrackwidthProfileCategory2RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02713               meErrxMFTrackwidthProfileCategory2RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02714             }
02715             if (rechitrphicategory == 3) {
02716               mePullTrackwidthProfileCategory3RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02717               meErrxMFTrackwidthProfileCategory3RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02718             }
02719             if (rechitrphicategory == 4) {
02720               mePullTrackwidthProfileCategory4RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02721               meErrxMFTrackwidthProfileCategory4RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02722             }
02723             meTrackwidthRphiTEC[ilay]->Fill(rechitrphitrackwidth);
02724             meExpectedwidthRphiTEC[ilay]->Fill(rechitrphiexpectedwidth);
02725             meClusterwidthRphiTEC[ilay]->Fill(clusizrphi);
02726             meCategoryRphiTEC[ilay]->Fill(rechitrphicategory);
02727             meErrxMFTrackwidthProfileRphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02728             meErrxMFAngleProfileRphiTEC[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02729           } 
02730           if(Tecisrechitsas!=0){
02731             if (rechitsasthickness > CutThickness)
02732               {
02733                 /*PullvsTrackwidthTEC->Fill(rechitsastrackwidth,rechitsaspullMF);
02734                 PullvsClusterwidthTEC->Fill(clusizsas,rechitsaspullMF);
02735                 PullvsExpectedwidthTEC->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02736                 PullvsTrackangleTEC->Fill(rechitsastrackangle,rechitsaspullMF);
02737                 PullvsTrackanglebetaTEC->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
02738               }
02739             meNstpSasTEC[ilay]->Fill(clusizsas);
02740             meAdcSasTEC[ilay]->Fill(cluchgsas);
02741             mePosxSasTEC[ilay]->Fill(rechitsasx);
02742             meErrxLFSasTEC[ilay]->Fill(sqrt(rechitsaserrxLF));
02743             meResLFSasTEC[ilay]->Fill(rechitsasresLF);
02744             mePullLFSasTEC[ilay]->Fill(rechitsaspullLF);
02745             meErrxMFSasTEC[ilay]->Fill(sqrt(rechitsaserrxMF));
02746             meResMFSasTEC[ilay]->Fill(rechitsasresMF);
02747             mePullMFSasTEC[ilay]->Fill(rechitsaspullMF);
02748             meTrackangleSasTEC[ilay]->Fill(rechitsastrackangle);
02749             mePullTrackangleProfileSasTEC[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02750             mePullTrackwidthProfileSasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02751             if (rechitsascategory == 1) {
02752               mePullTrackwidthProfileCategory1SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02753               meErrxMFTrackwidthProfileCategory1SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02754               meErrxMFClusterwidthProfileCategory1SasTEC[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02755             }
02756             if (rechitsascategory == 2) {
02757               mePullTrackwidthProfileCategory2SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02758               meErrxMFTrackwidthProfileCategory2SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02759             }
02760             if (rechitsascategory == 3) {
02761               mePullTrackwidthProfileCategory3SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02762               meErrxMFTrackwidthProfileCategory3SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02763             }
02764             if (rechitsascategory == 4) {
02765               mePullTrackwidthProfileCategory4SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02766               meErrxMFTrackwidthProfileCategory4SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02767             }
02768             meTrackwidthSasTEC[ilay]->Fill(rechitsastrackwidth);
02769             meExpectedwidthSasTEC[ilay]->Fill(rechitsasexpectedwidth);
02770             meClusterwidthSasTEC[ilay]->Fill(clusizsas);
02771             meCategorySasTEC[ilay]->Fill(rechitsascategory);
02772             meErrxMFTrackwidthProfileSasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02773             meErrxMFAngleProfileSasTEC[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02774           }
02775         
02776         }
02777         
02778       } //simplehits
02779       //cout<<"DebugLine301"<<endl;
02780       
02781     }
02782     //cout<<"DebugLine302"<<endl;
02783     
02784   }
02785   //cout<<"DebugLine303"<<endl;
02786 
02787 }
02788 
02789 
02790 
02791   //needed by to do the residual for matched hits
02792 std::pair<LocalPoint,LocalVector> SiStripTrackingRecHitsValid::projectHit( const PSimHit& hit, const StripGeomDetUnit* stripDet, const BoundPlane& plane) 
02793 {
02794   //  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(hit.det());
02795   //if (stripDet == 0) throw MeasurementDetException("HitMatcher hit is not on StripGeomDetUnit");
02796   
02797   const StripTopology& topol = stripDet->specificTopology();
02798   GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
02799   LocalPoint localHit = plane.toLocal(globalpos);
02800   //track direction
02801   LocalVector locdir=hit.localDirection();
02802   //rotate track in new frame
02803   
02804   GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
02805   LocalVector dir=plane.toLocal(globaldir);
02806   float scale = -localHit.z() / dir.z();
02807   
02808   LocalPoint projectedPos = localHit + scale*dir;
02809   
02810   //  std::cout << "projectedPos " << projectedPos << std::endl;
02811   
02812   float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
02813   
02814   LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0); // vector along strip in hit frame
02815   
02816   LocalVector localStripDir( plane.toLocal(stripDet->surface().toGlobal( stripDir)));
02817   
02818   return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
02819 }

Generated on Tue Jun 9 17:49:39 2009 for CMSSW by  doxygen 1.5.4