CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/Validation/RecoTrack/plugins/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("Tracking/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("Tracking/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("Tracking/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("Tracking/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("Tracking/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("Tracking/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("Tracking/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=0;
01281   float anglebeta=0;
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* hit2d=dynamic_cast<const SiStripRecHit2D*>((*thit2).hit());
01364       const SiStripRecHit1D* hit1d=dynamic_cast<const SiStripRecHit1D*>((*thit2).hit());
01365       //if(matchedhit) cout<<"manganomatchedhit"<<endl;
01366       //if(hit) cout<<"manganosimplehit"<<endl;
01367       //if (hit && matchedhit) cout<<"manganosimpleandmatchedhit"<<endl;
01368       const TrackingRecHit *thit = (*thit2).hit();
01369             
01370       detid = (thit)->geographicalId();
01371       myid=((thit)->geographicalId()).rawId();
01372 
01373       StripSubdetector StripSubdet = (StripSubdetector) detid;
01374 
01375       isrechitmatched  = 0;
01376       
01377       if(matchedhit){
01378 
01379         isrechitmatched = 1;
01380  
01381         position = (thit)->localPosition();
01382         //  Mposition = topol.measurementPosition(position);
01383         error = (thit)->localPositionError();
01384         //  Merror = topol.measurementError(position,error);
01385         rechitmatchedx = position.x();
01386         rechitmatchedy = position.y();
01387         rechitmatchedz = position.z();
01388         rechitmatchederrxx = error.xx();
01389         rechitmatchederrxy = error.xy();
01390         rechitmatchederryy = error.yy();
01391 
01392         //Association of the rechit to the simhit
01393         mindist = 999999;
01394         float distx, disty;
01395         std::pair<LocalPoint,LocalVector> closestPair;
01396         matched.clear();
01397         matched = associate.associateHit(*matchedhit);
01398         if(!matched.empty()){
01399           //project simhit;
01400           const GluedGeomDet* gluedDet = (const GluedGeomDet*)tracker.idToDet(matchedhit->geographicalId());
01401           const StripGeomDetUnit* partnerstripdet =(StripGeomDetUnit*) gluedDet->stereoDet();
01402           std::pair<LocalPoint,LocalVector> hitPair;
01403           for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01404             //project simhit;
01405             hitPair= projectHit((*m),partnerstripdet,gluedDet->surface());
01406             distx = fabs(rechitmatchedx - hitPair.first.x());
01407             disty = fabs(rechitmatchedy - hitPair.first.y());
01408             dist = distx*distx+disty*disty;
01409             if(sqrt(dist)<mindist){
01410               mindist = dist;
01411               closestPair = hitPair;
01412             }
01413           }
01414           rechitmatchedresx = rechitmatchedx - closestPair.first.x();
01415           rechitmatchedresy = rechitmatchedy - closestPair.first.y();
01416           rechitmatchedpullx = ((thit)->localPosition().x() - (closestPair.first.x()))/sqrt(error.xx());
01417           rechitmatchedpully = ((thit)->localPosition().y() - (closestPair.first.y()))/sqrt(error.yy());
01418         }
01419       }
01420  
01421       //Filling Histograms for Matched hits
01422 
01423       if(isrechitmatched){
01424 
01425         if (detid.subdetId() == int(StripSubdetector::TIB)){
01426           TIBDetId tibid(myid);
01427           int Tibisrechitmatched = isrechitmatched;
01428           int ilay = tibid.layer() - 1; //for histogram filling
01429           if(Tibisrechitmatched>0){
01430             mePosxMatchedTIB[ilay]->Fill(rechitmatchedx);
01431             meErrxMatchedTIB[ilay]->Fill(sqrt(rechitmatchederrxx));
01432             meErryMatchedTIB[ilay]->Fill(sqrt(rechitmatchederryy));
01433             meResxMatchedTIB[ilay]->Fill(rechitmatchedresx);
01434             meResyMatchedTIB[ilay]->Fill(rechitmatchedresy);
01435             mePullxMatchedTIB[ilay]->Fill(rechitmatchedpullx);
01436             mePullyMatchedTIB[ilay]->Fill(rechitmatchedpully);
01437 
01438           }
01439         }
01440               
01441         if (detid.subdetId() == int(StripSubdetector::TOB)){
01442           TOBDetId tobid(myid);
01443           int Tobisrechitmatched = isrechitmatched;
01444           int ilay = tobid.layer() - 1; //for histogram filling
01445           if(Tobisrechitmatched>0){
01446             mePosxMatchedTOB[ilay]->Fill(rechitmatchedx);
01447             mePosyMatchedTOB[ilay]->Fill(rechitmatchedy);
01448             meErrxMatchedTOB[ilay]->Fill(sqrt(rechitmatchederrxx));
01449             meErryMatchedTOB[ilay]->Fill(sqrt(rechitmatchederryy));
01450             meResxMatchedTOB[ilay]->Fill(rechitmatchedresx);
01451             meResyMatchedTOB[ilay]->Fill(rechitmatchedresy);
01452             mePullxMatchedTOB[ilay]->Fill(rechitmatchedpullx);
01453             mePullyMatchedTOB[ilay]->Fill(rechitmatchedpully);
01454           }
01455         }
01456         if (detid.subdetId() == int(StripSubdetector::TID)){
01457           TIDDetId tidid(myid);
01458           int Tidisrechitmatched = isrechitmatched;
01459           int ilay = tidid.ring() - 1; //for histogram filling
01460           if(Tidisrechitmatched>0){
01461             mePosxMatchedTID[ilay]->Fill(rechitmatchedx);
01462             mePosyMatchedTID[ilay]->Fill(rechitmatchedy);
01463             meErrxMatchedTID[ilay]->Fill(sqrt(rechitmatchederrxx));
01464             meErryMatchedTID[ilay]->Fill(sqrt(rechitmatchederryy));
01465             meResxMatchedTID[ilay]->Fill(rechitmatchedresx);
01466             meResyMatchedTID[ilay]->Fill(rechitmatchedresy);
01467             mePullxMatchedTID[ilay]->Fill(rechitmatchedpullx);
01468             mePullyMatchedTID[ilay]->Fill(rechitmatchedpully);
01469           }
01470         }
01471         if (detid.subdetId() == int(StripSubdetector::TEC)){
01472           TECDetId tecid(myid);
01473           int Tecisrechitmatched = isrechitmatched;
01474           int ilay = tecid.ring() - 1; //for histogram filling
01475           if(Tecisrechitmatched>0){
01476             mePosxMatchedTEC[ilay]->Fill(rechitmatchedx);
01477             mePosyMatchedTEC[ilay]->Fill(rechitmatchedy);
01478             meErrxMatchedTEC[ilay]->Fill(sqrt(rechitmatchederrxx));
01479             meErryMatchedTEC[ilay]->Fill(sqrt(rechitmatchederryy));
01480             meResxMatchedTEC[ilay]->Fill(rechitmatchedresx);
01481             meResyMatchedTEC[ilay]->Fill(rechitmatchedresy);
01482             mePullxMatchedTEC[ilay]->Fill(rechitmatchedpullx);
01483             mePullyMatchedTEC[ilay]->Fill(rechitmatchedpully);
01484           }
01485         }
01486               
01487       }
01488       
01489               
01491       // simple hits from matched hits
01493       // Reset variables
01494       
01495       isrechitrphi    = 0;
01496       isrechitsas     = 0;
01497       rechitrphix =0;
01498       rechitrphierrxLF =0;
01499       rechitrphierrxMF =0;
01500       rechitrphiy =0;
01501       rechitrphiz =0;
01502       rechitsasx =0;
01503       rechitsaserrxLF =0;
01504       rechitsaserrxMF =0;
01505       rechitsasy =0;
01506       rechitsasz =0;
01507       clusizrphi =0;
01508       clusizsas =0;
01509       cluchgrphi =0;
01510       cluchgsas =0;
01511       rechitrphiresLF=-999.;
01512       rechitrphiresMF=-999.;
01513       rechitrphipullLF=-999.;
01514       rechitrphipullMF=-999.;
01515       rechitrphitrackangle =0;
01516       rechitrphitrackanglebeta =0;
01517       rechitrphitrackangle2 =0;
01518       rechitrphitrackwidth =0;
01519       rechitrphiexpectedwidth =0;
01520       rechitrphicategory =0;
01521       rechitrphithickness = 0.;
01522       rechitsasresLF=-999.;
01523       rechitsasresMF=-999.;
01524       rechitsaspullLF=-999.;
01525       rechitsaspullMF=-999.;
01526       rechitsastrackangle =0;
01527       rechitsastrackanglebeta =0;
01528       rechitsasthickness = 0;
01529 
01530       GluedGeomDet * gdet;
01531       const GeomDetUnit * monodet;
01532       const SiStripRecHit2D *monohit;
01533       const StripGeomDetUnit * stripdet;
01534 
01535       if (matchedhit)
01536         {
01537           monohit=matchedhit->monoHit();
01538           //      const GeomDetUnit * monodet=gdet->monoDet();
01539           gdet=(GluedGeomDet *)tracker2->idToDet(matchedhit->geographicalId());
01540           monodet=gdet->monoDet();
01541           GlobalVector gtrkdir=gdet->toGlobal(trackdirection);
01542           LocalVector monotkdir=monodet->toLocal(gtrkdir);
01543           //      const GeomDetUnit *  det = tracker.idToDetUnit(detid);
01544           //stripdet=(const StripGeomDetUnit*)(gdet);
01545           stripdet=(const StripGeomDetUnit*)(monodet);
01546           //      const StripTopology &topol2=(StripTopology&)stripdet->topology();
01547 
01548           if(monotkdir.z()!=0){
01549             anglealpha = atan(monotkdir.x()/monotkdir.z())*180/TMath::Pi();
01550             anglebeta = atan(monotkdir.y()/monotkdir.z())*180/TMath::Pi();
01551           }
01552           
01553           if(monohit){
01554 
01555             const StripTopology &topol=(StripTopology&)stripdet->topology();
01556 
01557             position = monohit->localPosition();
01558             error = monohit->localPositionError();
01559             Mposition = topol.measurementPosition(position);
01560             Merror = topol.measurementError(position,error);
01561 
01562             LocalVector drift = stripcpe->driftDirection(stripdet);
01563             float thickness=stripdet->surface().bounds().thickness();
01564             rechitrphithickness = thickness;
01565 
01566             //cout<<"thickness = "<<thickness<<endl;
01567             float pitch = topol.localPitch(position);
01568             //cout<<"Valid:pitch = "<<pitch<<endl;
01569             float tanalpha = tan(anglealpha/57.3);
01570             //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01571             float tanalphaL = drift.x()/drift.z();
01572             //float tanalphaLbis = driftbis.x()/driftbis.z();
01573             //float tanalphaLter = driftter.x()/driftter.z();
01574             //cout<<"Validmonofrommatched:drift.x() = "<<drift.x()<<endl;
01575             //cout<<"Valid:drift.x() = "<<drift.x()<<endl;
01576             //cout<<"Valid:driftbis.x() = "<<driftbis.x()<<endl;
01577             //cout<<"Valid:driftter.x() = "<<driftter.x()<<endl;
01578             //cout<<"Valid:driftter.z() = "<<driftter.z()<<endl;
01579             //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01580             Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01581             //cout<<"Valid1:Wtrack = "<<Wtrack<<endl;
01582             float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01583             //int nstrips = topol.nstrips(); 
01584             //clusterWidth = cluster->amplitudes().size();
01585             int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01586             int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01587             Wexp = 1+Sp-Sm;
01588             //cout<<"DebugLine22"<<endl;
01589 
01590             isrechitrphi = 1;
01591             //cout<<"DebugLine23"<<endl;
01592             //          const edm::Ref<edm::DetSetVector<SiStripCluster>, SiStripCluster, edm::refhelper::FindForDetSetVector<SiStripCluster> > cluster=hit->cluster();
01593             SiStripRecHit2D::ClusterRef cluster=monohit->cluster();
01594             //SiStripRecHit1D::ClusterRef cluster=monohit->cluster();
01595             clusiz=0;
01596             totcharge=0;
01597             clusiz = cluster->amplitudes().size();
01598             //      cout<<"clusiz = "<<clusiz<<endl;
01599             const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01600             for(size_t ia=0; ia<amplitudes.size();ia++){
01601               totcharge+=amplitudes[ia];
01602             }
01603             rechitrphix = position.x();
01604             rechitrphiy = position.y();
01605             rechitrphiz = position.z();
01606             rechitrphierrxLF = error.xx();
01607             rechitrphierrxMF = Merror.uu();
01608             //      cout<<"rechitrphierrxMF from Matched hit= "<<sqrt(rechitrphierrxMF)<<endl;
01609             clusizrphi = clusiz;
01610             cluchgrphi = totcharge;
01611 
01612             //Association of the rechit to the simhit
01613             mindist = 999999;
01614             matched.clear();  
01615             //          matched = associate.associateHit(*hit);
01616             matched = associate.associateHit(*monohit);
01617             if(!matched.empty()){
01618               //                  cout << "\t\t\tmatched  " << matched.size() << endl;
01619               //              cout<<"associatesimplehit"<<endl;
01620               for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01621                 dist = abs((monohit)->localPosition().x() - (*m).localPosition().x());
01622                 if(dist<mindist){
01623                   mindist = dist;
01624                   closest = (*m);
01625                 }
01626                 rechitrphiresLF = rechitrphix - closest.localPosition().x();
01627                 rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
01628                 rechitrphipullLF =  rechitrphiresLF/sqrt(rechitrphierrxLF);
01629                 rechitrphipullMF = rechitrphiresMF/sqrt(rechitrphierrxMF);
01630                 //cout<<"rechitrphiresMF == "<<rechitrphiresMF<<endl;
01631                 //cout<<"rechitrphierrxMF == "<<rechitrphierrxMF<<endl;
01632                 //cout<<"rechitrphierrxLF == "<<rechitrphierrxLF<<endl;
01633                 //cout<<"rechitrphipullMF == "<<rechitrphipullMF<<endl;
01634 
01635               }
01636             }
01637             rechitrphitrackangle = anglealpha;
01638             rechitrphitrackanglebeta = anglebeta;
01639             //rechitrphitrackangle = tanalphaL;
01640             //cout<<"Wtrack = "<<Wtrack<<endl;
01641             rechitrphitrackwidth = Wtrack;
01642             rechitrphiexpectedwidth = Wexp;
01643             clusterWidth = clusiz;
01644             unsigned int iopt;
01645             if (clusterWidth > Wexp + 2) {
01646               iopt = 1;
01647             } else if (Wexp == 1) {
01648               iopt = 2;
01649             } else if (clusterWidth <= Wexp) {
01650               iopt = 3;
01651             } else {
01652               iopt = 4;
01653             }
01654             rechitrphicategory = iopt;
01655           }
01656            
01657  
01658           const SiStripRecHit2D *stereohit;
01659           stereohit=matchedhit->stereoHit();
01660           const GeomDetUnit * stereodet=gdet->stereoDet(); 
01661           //      GlobalVector 
01662           gtrkdir=gdet->toGlobal(trackdirection);
01663           LocalVector stereotkdir=stereodet->toLocal(gtrkdir);
01664           if(stereotkdir.z()!=0){
01665             anglealpha = atan(stereotkdir.x()/stereotkdir.z())*180/TMath::Pi();
01666             anglebeta = atan(stereotkdir.y()/stereotkdir.z())*180/TMath::Pi();
01667           }
01668           
01669           if (stereohit)
01670             {
01671               //              cout<<"stereohit from matched hit"<<endl;
01672               isrechitsas = 1;
01673               SiStripRecHit2D::ClusterRef cluster=stereohit->cluster();
01674             
01675               //              const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
01676               const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(stereodet);
01677               const StripTopology &topol=(StripTopology&)stripdet->topology();
01678 
01679               position = stereohit->localPosition();
01680               //  Mposition = topol.measurementPosition(position);
01681               error = stereohit->localPositionError();
01682               Mposition = topol.measurementPosition(position);
01683               Merror = topol.measurementError(position,error);
01684 
01685               //LocalVector drift= driftDirection(stripdet);
01686               LocalVector drift = stripcpe->driftDirection(stripdet);
01687               float thickness=stripdet->surface().bounds().thickness();
01688               rechitsasthickness = thickness;
01689               //cout<<"thickness = "<<thickness<<endl;
01690               float pitch = topol.localPitch(position);
01691               //cout<<"Valid:pitch = "<<pitch<<endl;
01692               float tanalpha = tan(anglealpha/57.3);
01693               //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01694               float tanalphaL = drift.x()/drift.z();
01695               //cout<<"Validstereofrommatched:drift.x() = "<<drift.x()<<endl;
01696               //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
01697               //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01698               Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01699               //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
01700               float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01701               //int nstrips = topol.nstrips(); 
01702               int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01703               int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01704               Wexp = 1+Sp-Sm;
01705 
01706 
01707               clusiz=0;
01708               totcharge=0;
01709               clusiz = cluster->amplitudes().size();
01710               const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01711               for(size_t ia=0; ia<amplitudes.size();ia++){
01712                 totcharge+=amplitudes[ia];
01713               }
01714               rechitsasx = position.x();
01715               rechitsasy = position.y();
01716               rechitsasz = position.z();
01717               rechitsaserrxLF = error.xx();
01718               //              cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
01719               rechitsaserrxMF = Merror.uu();
01720               //              cout<<"rechitsaserrxMF from Matched hit = "<<sqrt(rechitsaserrxMF)<<endl;
01721               clusizsas = clusiz;
01722               cluchgsas = totcharge;
01723 
01724               //Association of the rechit to the simhit
01725               mindist = 999999;
01726               matched.clear();  
01727               matched = associate.associateHit(*stereohit);
01728               if(!matched.empty()){
01729                 //                cout << "\t\t\tmatched  " << matched.size() << endl;
01730                 for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01731                   dist = abs((stereohit)->localPosition().x() - (*m).localPosition().x());
01732                   if(dist<mindist){
01733                     mindist = dist;
01734                     closest = (*m);
01735                   }
01736 
01737                   rechitsasresLF = rechitsasx - closest.localPosition().x();
01738                   rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
01739                   rechitsaspullLF = rechitsasresLF/sqrt(rechitsaserrxLF);
01740                   rechitsaspullMF = rechitsasresMF/sqrt(rechitsaserrxMF);
01741                   
01742 //                cout<<"rechitsasresMF == "<<rechitsasresMF<<endl;
01743 //                cout<<"rechitsaserrxMF == "<<rechitsaserrxMF<<endl;
01744 //                cout<<"rechitsaserrxLF == "<<rechitsaserrxLF<<endl;
01745 //                cout<<"rechitsaspullMF == "<<rechitsaspullMF<<endl;
01746                   
01747                 }
01748               }
01749               rechitsastrackangle = anglealpha;
01750               rechitsastrackanglebeta = anglebeta;
01751               rechitsastrackwidth = Wtrack;
01752               rechitsasexpectedwidth = Wexp;
01753 
01754               clusterWidth = clusiz;
01755               unsigned int iopt;
01756               if (clusterWidth > Wexp + 2) {
01757                 iopt = 1;
01758               } else if (Wexp == 1) {
01759                 iopt = 2;
01760               } else if (clusterWidth <= Wexp) {
01761                 iopt = 3;
01762               } else {
01763                 iopt = 4;
01764               }
01765               rechitsascategory = iopt;
01766             }
01767         }
01768 
01769 
01770       // A VIRER !!!!!!!!!!!!!!!!!!!!
01771 
01772       //    isrechitrphi = 0;
01773       //isrechitsas = 0;
01774       
01775       
01776       if(hit1d){
01777         // simple hits are mono or stereo
01778         //      cout<<"simple hit"<<endl;
01779         if (StripSubdet.stereo() == 0){
01780           isrechitrphi = 1;
01781           //      cout<<"simple hit mono"<<endl;
01782 
01783           const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
01784           const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
01785           const StripTopology &topol=(StripTopology&)stripdet->topology();
01786 
01787           float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
01788           float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
01789 
01790           //SiStripRecHit2D::ClusterRef cluster=hit->cluster();
01791           SiStripRecHit1D::ClusterRef cluster=hit1d->cluster();
01792 
01793           position = thit->localPosition();
01794           error = thit->localPositionError();
01795           Mposition = topol.measurementPosition(position);
01796           Merror = topol.measurementError(position,error);
01797 
01798           LocalVector drift = stripcpe->driftDirection(stripdet);
01799           float thickness=stripdet->surface().bounds().thickness();
01800           rechitrphithickness = thickness;
01801           //cout<<"Valid:thickness = "<<thickness<<endl;
01802           float pitch = topol.localPitch(position);
01803           //cout<<"Valid:pitch = "<<pitch<<endl;
01804           float tanalpha = tan(anglealpha/57.3);
01805           //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01806           float tanalphaL = drift.x()/drift.z();
01807           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01808           //      float tanalphaLcpe = driftcpe.x()/driftcpe.z();
01809           //cout<<"Valid:tanalphaLcpe = "<<tanalphaLcpe<<endl;
01810           //cout<<"Validmono:drift.x() = "<<drift.x()<<endl;
01811           //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
01812           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01813           Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01814           //       fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01815           //cout<<"Valid2:Wtrack = "<<Wtrack<<endl;
01816           float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01817           //int nstrips = topol.nstrips(); 
01818           int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01819           int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01820           Wexp = 1+Sp-Sm;
01821 
01822           clusiz=0;
01823           totcharge=0;
01824           clusiz = cluster->amplitudes().size();
01825           //cout<<"cluster->firstStrip() = "<<cluster->firstStrip()<<endl;
01826           const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01827           for(size_t ia=0; ia<amplitudes.size();ia++){
01828             totcharge+=amplitudes[ia];
01829           }
01830           rechitrphix = position.x();
01831           rechitrphiy = position.y();
01832           rechitrphiz = position.z();
01833           rechitrphierrx = error.xx();
01834           rechitrphierrxLF = error.xx();
01835           rechitrphierrxMF = Merror.uu();
01836           //cout<<"rechitrphierrxMF simple hit= "<<sqrt(rechitrphierrxMF)<<endl;
01837           clusizrphi = clusiz;
01838           //cout<<"clusizrphi = "<<clusiz<<endl;
01839           cluchgrphi = totcharge;
01840 
01841           //Association of the rechit to the simhit
01842           mindist = 999999;
01843           matched.clear();  
01844           matched = associate.associateHit(*hit1d);
01845           if(!matched.empty()){
01846             //            cout << "\t\t\tmatched  " << matched.size() << endl;
01847             for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
01848               dist = abs((hit1d)->localPosition().x() - (*m).localPosition().x());
01849               if(dist<mindist){
01850                 mindist = dist;
01851                 closest = (*m);
01852               }
01853               rechitrphiresLF = rechitrphix - closest.localPosition().x();
01854               rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
01855               rechitrphipullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
01856               rechitrphipullMF = rechitrphiresMF/sqrt(rechitrphierrxMF);
01857             }
01858           }
01859           rechitrphitrackangle = anglealpha;
01860           rechitrphitrackanglebeta = anglebeta;
01861           rechitrphitrackwidth = Wtrack;
01862           rechitrphiexpectedwidth = Wexp;
01863 
01864           clusterWidth = clusiz;
01865           unsigned int iopt;
01866           if (clusterWidth > Wexp + 2) {
01867             iopt = 1;
01868           } else if (Wexp == 1) {
01869             iopt = 2;
01870           } else if (clusterWidth <= Wexp) {
01871             iopt = 3;
01872           } else {
01873             iopt = 4;
01874           }
01875           rechitrphicategory = iopt;
01876           
01877 //        if (rechitrphiexpectedwidth == 1 && clusterWidth == 3) {
01878 //        //if ( clusterWidth == 3) {
01879 //          cout<<"TRUE"<<endl;
01880 //          cout<<"TestClus2:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
01881 //          cout<<"TestClus2:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
01882 //          cout<<"TestClus2:residue = "<<rechitrphiresMF<<endl;
01883 //          short firstStrip = cluster->firstStrip();
01884 //          short lastStrip = firstStrip + clusterWidth - 1;
01885 //          cout<<"TestClus2:firstStrip = "<<firstStrip<<endl;
01886 //          cout<<"TestClus2:lastStrip = "<<lastStrip<<endl;
01887 //          cout<<"TestClus2:detid = "<<detid.subdetId()<<endl;
01888 //          for(size_t ia=0; ia<amplitudes.size();ia++){
01889 //            cout<<"ia, TestClus2:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
01890 //          }
01891 //          cout<<"TestClus2:Trackwidth = "<<Wtrack<<endl;
01892 //        }
01893           
01894         
01895           //cout<<"rechitrphicategory = "<<rechitrphicategory<<endl;
01896 
01897           //      if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
01898             //if ((detid.subdetId() == int(StripSubdetector::TIB))) {
01899            
01900 //          if (clusterWidth ==2 && Wexp == 1 && Wtrack<0.1) {
01901 //            cout<<"TestClus:begin"<<endl;
01902 //            LocalVector  drift2 = drift * fabs(thickness/drift.z());       
01903 //            LocalPoint result2=LocalPoint(position.x()-drift2.x()/2,position.y()-drift2.y()/2,0);
01904 //            MeasurementPoint mpoint=topol.measurementPosition(result2);
01905 //            cout<<"TestClus:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
01906 //            cout<<"TestClus:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
01907 //            cout<<"TestClus:Position RH no drift= "<<thit->localPosition().x() - drift2.x()/2<<" , "<<mpoint.x()<<endl;
01908 //            cout<<"TestClus:Drift= "<<drift.x()<<endl;
01909 //            cout<<"TestClus:residue = "<<rechitrphiresMF<<endl;
01910 //            for(size_t ia=0; ia<amplitudes.size();ia++){
01911 //              cout<<"ia, TestClus:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
01912 //            }
01913 //            cout<<"TestClus:Trackwidth = "<<Wtrack<<endl;
01914 //            short firstStrip = cluster->firstStrip();
01915 //            short lastStrip = firstStrip + clusterWidth - 1;
01916 //            cout<<"TestClus:firstStrip = "<<firstStrip<<endl;
01917 //            cout<<"TestClus:lastStrip = "<<lastStrip<<endl;
01918 //            cout<<"TestClus:detid = "<<detid.subdetId()<<endl;
01919 //            int nstrips = topol.nstrips(); 
01920 //            cout<<"TestClus:nstrips = "<<nstrips<<endl;
01921 //            cout<<"TestClus:anglealpha = "<<anglealpha<<endl;
01922 //            cout<<"TestClus:end"<<endl;
01923 //            positionshx = (topol.measurementPosition(closest.localPosition())).x();
01924 
01925 //            if ((positionshx - int(positionshx)) > 0.5) {
01926 //              if (lastStrip > int(positionshx)) secondstrip = 1;
01927 //              if (lastStrip = int(positionshx)) secondstrip = -1;
01928 //            }
01929 //            if ((positionshx - int(positionshx)) < 0.5) {
01930 //              if (lastStrip > int(positionshx)) secondstrip = -1;
01931 //              if (lastStrip = int(positionshx)) secondstrip = 1;
01932 //            }
01933 
01934 //          }
01935 
01936             //}
01937           
01938 //        cout<<"int() = "<<int((topol.measurementPosition(closest.localPosition())).x())<<endl;
01939 //        diff = int((topol.measurementPosition(closest.localPosition())).x()) -topol.measurementPosition(closest.localPosition()).x();
01940 //        cout<<"diff = "<<diff<<endl;
01941 //        if (clusterWidth ==2 && Wexp == 1 && Wtrack<1) {
01942 //          if ((abs(1 + diff) <0.2) || (abs(diff) <0.2)) {
01943 //            //              isrechitrphi = 0;
01944 //            cout<<"vire"<<endl;
01945 //          }
01946 //        }
01947 //        positionshx = (topol.measurementPosition(closest.localPosition())).x();
01948 
01949 
01950         }
01951 
01952         if (StripSubdet.stereo() == 1){
01953 
01954           //cout<<"simple hit stereo"<<endl;
01955           isrechitsas = 1;
01956 
01957           const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
01958           const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
01959           const StripTopology &topol=(StripTopology&)stripdet->topology();
01960 
01961           float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
01962           float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
01963 
01964           //SiStripRecHit2D::ClusterRef cluster=hit->cluster();
01965           SiStripRecHit1D::ClusterRef cluster=hit1d->cluster();
01966 
01967 
01968           position = thit->localPosition();
01969           error = thit->localPositionError();
01970           Mposition = topol.measurementPosition(position);
01971           Merror = topol.measurementError(position,error);
01972 
01973           //      LocalVector drift= driftDirection(stripdet);
01974           LocalVector drift = stripcpe->driftDirection(stripdet);
01975           float thickness=stripdet->surface().bounds().thickness();
01976           rechitsasthickness = thickness;
01977           //cout<<"thickness = "<<thickness<<endl;
01978           float pitch = topol.localPitch(position);
01979           //cout<<"Valid:pitch = "<<pitch<<endl;
01980           float tanalpha = tan(anglealpha/57.3);
01981           //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
01982           float tanalphaL = drift.x()/drift.z();
01983           //cout<<"Validstereo:drift.x() = "<<drift.x()<<endl;
01984           //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
01985           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
01986           Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
01987           //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
01988           float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
01989           //int nstrips = topol.nstrips(); 
01990           int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
01991           int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
01992           Wexp = 1+Sp-Sm;
01993 
01994           clusiz=0;
01995           totcharge=0;
01996           clusiz = cluster->amplitudes().size();
01997           const std::vector<uint8_t> amplitudes=cluster->amplitudes();
01998           for(size_t ia=0; ia<amplitudes.size();ia++){
01999             totcharge+=amplitudes[ia];
02000           }
02001           rechitsasx = position.x();
02002           rechitsasy = position.y();
02003           rechitsasz = position.z();
02004           rechitsaserrxLF = error.xx();
02005           //cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
02006           rechitsaserrxMF = Merror.uu();
02007           //cout<<"rechitsaserrxMF simple hit= "<<sqrt(rechitsaserrxMF)<<endl;
02008           clusizsas = clusiz;
02009           cluchgsas = totcharge;
02010 
02011           //Association of the rechit to the simhit
02012           mindist = 999999;
02013           matched.clear();  
02014           matched = associate.associateHit(*hit1d);
02015           if(!matched.empty()){
02016             //            cout << "\t\t\tmatched  " << matched.size() << endl;
02017             for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
02018               dist = abs((hit1d)->localPosition().x() - (*m).localPosition().x());
02019               if(dist<mindist){
02020                 mindist = dist;
02021                 closest = (*m);
02022               }
02023 
02024               rechitsasresLF = rechitsasx - closest.localPosition().x();
02025               rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
02026               rechitsaspullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
02027               rechitsaspullMF = rechitsasresMF/sqrt(rechitsaserrxMF);
02028 
02029             }
02030           }
02031           rechitsastrackangle = anglealpha;
02032           rechitsastrackanglebeta = anglebeta;
02033           rechitsastrackwidth = Wtrack;
02034           rechitsasexpectedwidth = Wexp;
02035 
02036           clusterWidth = clusiz;
02037           unsigned int iopt;
02038           if (clusterWidth > Wexp + 2) {
02039             iopt = 1;
02040           } else if (Wexp == 1) {
02041             iopt = 2;
02042           } else if (clusterWidth <= Wexp) {
02043             iopt = 3;
02044           } else {
02045             iopt = 4;
02046           }
02047           rechitsascategory = iopt;
02048         }
02049         //isrechitsas = 0;
02050       }
02051 
02052 
02053       if(hit2d){
02054         // simple hits are mono or stereo
02055         //      cout<<"simple hit"<<endl;
02056         if (StripSubdet.stereo() == 0){
02057           isrechitrphi = 1;
02058           //      cout<<"simple hit mono"<<endl;
02059 
02060           const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
02061           const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
02062           const StripTopology &topol=(StripTopology&)stripdet->topology();
02063 
02064           float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
02065           float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
02066 
02067           SiStripRecHit2D::ClusterRef cluster=hit2d->cluster();
02068 
02069           position = thit->localPosition();
02070           error = thit->localPositionError();
02071           Mposition = topol.measurementPosition(position);
02072           Merror = topol.measurementError(position,error);
02073 
02074           LocalVector drift = stripcpe->driftDirection(stripdet);
02075           float thickness=stripdet->surface().bounds().thickness();
02076           rechitrphithickness = thickness;
02077           //cout<<"Valid:thickness = "<<thickness<<endl;
02078           float pitch = topol.localPitch(position);
02079           //cout<<"Valid:pitch = "<<pitch<<endl;
02080           float tanalpha = tan(anglealpha/57.3);
02081           //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
02082           float tanalphaL = drift.x()/drift.z();
02083           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
02084           //      float tanalphaLcpe = driftcpe.x()/driftcpe.z();
02085           //cout<<"Valid:tanalphaLcpe = "<<tanalphaLcpe<<endl;
02086           //cout<<"Validmono:drift.x() = "<<drift.x()<<endl;
02087           //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
02088           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
02089           Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
02090           //       fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
02091           //cout<<"Valid2:Wtrack = "<<Wtrack<<endl;
02092           float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
02093           //int nstrips = topol.nstrips(); 
02094           int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
02095           int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
02096           Wexp = 1+Sp-Sm;
02097 
02098           clusiz=0;
02099           totcharge=0;
02100           clusiz = cluster->amplitudes().size();
02101           //cout<<"cluster->firstStrip() = "<<cluster->firstStrip()<<endl;
02102           const std::vector<uint8_t> amplitudes=cluster->amplitudes();
02103           for(size_t ia=0; ia<amplitudes.size();ia++){
02104             totcharge+=amplitudes[ia];
02105           }
02106           rechitrphix = position.x();
02107           rechitrphiy = position.y();
02108           rechitrphiz = position.z();
02109           rechitrphierrx = error.xx();
02110           rechitrphierrxLF = error.xx();
02111           rechitrphierrxMF = Merror.uu();
02112           //cout<<"rechitrphierrxMF simple hit= "<<sqrt(rechitrphierrxMF)<<endl;
02113           clusizrphi = clusiz;
02114           //cout<<"clusizrphi = "<<clusiz<<endl;
02115           cluchgrphi = totcharge;
02116 
02117           //Association of the rechit to the simhit
02118           mindist = 999999;
02119           matched.clear();  
02120           matched = associate.associateHit(*hit2d);
02121           if(!matched.empty()){
02122             //            cout << "\t\t\tmatched  " << matched.size() << endl;
02123             for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
02124               dist = abs((hit2d)->localPosition().x() - (*m).localPosition().x());
02125               if(dist<mindist){
02126                 mindist = dist;
02127                 closest = (*m);
02128               }
02129               rechitrphiresLF = rechitrphix - closest.localPosition().x();
02130               rechitrphiresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
02131               rechitrphipullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
02132               rechitrphipullMF = rechitrphiresMF/sqrt(rechitrphierrxMF);
02133             }
02134           }
02135           rechitrphitrackangle = anglealpha;
02136           rechitrphitrackanglebeta = anglebeta;
02137           rechitrphitrackwidth = Wtrack;
02138           rechitrphiexpectedwidth = Wexp;
02139 
02140           clusterWidth = clusiz;
02141           unsigned int iopt;
02142           if (clusterWidth > Wexp + 2) {
02143             iopt = 1;
02144           } else if (Wexp == 1) {
02145             iopt = 2;
02146           } else if (clusterWidth <= Wexp) {
02147             iopt = 3;
02148           } else {
02149             iopt = 4;
02150           }
02151           rechitrphicategory = iopt;
02152           
02153 //        if (rechitrphiexpectedwidth == 1 && clusterWidth == 3) {
02154 //        //if ( clusterWidth == 3) {
02155 //          cout<<"TRUE"<<endl;
02156 //          cout<<"TestClus2:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
02157 //          cout<<"TestClus2:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
02158 //          cout<<"TestClus2:residue = "<<rechitrphiresMF<<endl;
02159 //          short firstStrip = cluster->firstStrip();
02160 //          short lastStrip = firstStrip + clusterWidth - 1;
02161 //          cout<<"TestClus2:firstStrip = "<<firstStrip<<endl;
02162 //          cout<<"TestClus2:lastStrip = "<<lastStrip<<endl;
02163 //          cout<<"TestClus2:detid = "<<detid.subdetId()<<endl;
02164 //          for(size_t ia=0; ia<amplitudes.size();ia++){
02165 //            cout<<"ia, TestClus2:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
02166 //          }
02167 //          cout<<"TestClus2:Trackwidth = "<<Wtrack<<endl;
02168 //        }
02169           
02170         
02171           //cout<<"rechitrphicategory = "<<rechitrphicategory<<endl;
02172 
02173           //      if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
02174             //if ((detid.subdetId() == int(StripSubdetector::TIB))) {
02175            
02176 //          if (clusterWidth ==2 && Wexp == 1 && Wtrack<0.1) {
02177 //            cout<<"TestClus:begin"<<endl;
02178 //            LocalVector  drift2 = drift * fabs(thickness/drift.z());       
02179 //            LocalPoint result2=LocalPoint(position.x()-drift2.x()/2,position.y()-drift2.y()/2,0);
02180 //            MeasurementPoint mpoint=topol.measurementPosition(result2);
02181 //            cout<<"TestClus:Position SH = "<<(closest).localPosition().x()<<" , "<<(topol.measurementPosition(closest.localPosition())).x()<<endl;
02182 //            cout<<"TestClus:Position RH = "<<thit->localPosition().x()<<" ,"<<Mposition.x()<<endl;
02183 //            cout<<"TestClus:Position RH no drift= "<<thit->localPosition().x() - drift2.x()/2<<" , "<<mpoint.x()<<endl;
02184 //            cout<<"TestClus:Drift= "<<drift.x()<<endl;
02185 //            cout<<"TestClus:residue = "<<rechitrphiresMF<<endl;
02186 //            for(size_t ia=0; ia<amplitudes.size();ia++){
02187 //              cout<<"ia, TestClus:charge= "<<ia<<" , "<<amplitudes[ia]<<endl;
02188 //            }
02189 //            cout<<"TestClus:Trackwidth = "<<Wtrack<<endl;
02190 //            short firstStrip = cluster->firstStrip();
02191 //            short lastStrip = firstStrip + clusterWidth - 1;
02192 //            cout<<"TestClus:firstStrip = "<<firstStrip<<endl;
02193 //            cout<<"TestClus:lastStrip = "<<lastStrip<<endl;
02194 //            cout<<"TestClus:detid = "<<detid.subdetId()<<endl;
02195 //            int nstrips = topol.nstrips(); 
02196 //            cout<<"TestClus:nstrips = "<<nstrips<<endl;
02197 //            cout<<"TestClus:anglealpha = "<<anglealpha<<endl;
02198 //            cout<<"TestClus:end"<<endl;
02199 //            positionshx = (topol.measurementPosition(closest.localPosition())).x();
02200 
02201 //            if ((positionshx - int(positionshx)) > 0.5) {
02202 //              if (lastStrip > int(positionshx)) secondstrip = 1;
02203 //              if (lastStrip = int(positionshx)) secondstrip = -1;
02204 //            }
02205 //            if ((positionshx - int(positionshx)) < 0.5) {
02206 //              if (lastStrip > int(positionshx)) secondstrip = -1;
02207 //              if (lastStrip = int(positionshx)) secondstrip = 1;
02208 //            }
02209 
02210 //          }
02211 
02212             //}
02213           
02214 //        cout<<"int() = "<<int((topol.measurementPosition(closest.localPosition())).x())<<endl;
02215 //        diff = int((topol.measurementPosition(closest.localPosition())).x()) -topol.measurementPosition(closest.localPosition()).x();
02216 //        cout<<"diff = "<<diff<<endl;
02217 //        if (clusterWidth ==2 && Wexp == 1 && Wtrack<1) {
02218 //          if ((abs(1 + diff) <0.2) || (abs(diff) <0.2)) {
02219 //            //              isrechitrphi = 0;
02220 //            cout<<"vire"<<endl;
02221 //          }
02222 //        }
02223 //        positionshx = (topol.measurementPosition(closest.localPosition())).x();
02224 
02225 
02226         }
02227 
02228         if (StripSubdet.stereo() == 1){
02229 
02230           //cout<<"simple hit stereo"<<endl;
02231           isrechitsas = 1;
02232 
02233           const GeomDetUnit *  det = tracker.idToDetUnit(detid2);
02234           const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)(det);
02235           const StripTopology &topol=(StripTopology&)stripdet->topology();
02236 
02237           float anglealpha = atan(trackdirection.x()/trackdirection.z())*180/TMath::Pi();
02238           float anglebeta = atan(trackdirection.y()/trackdirection.z())*180/TMath::Pi();
02239 
02240           SiStripRecHit2D::ClusterRef cluster=hit2d->cluster();
02241 
02242 
02243           position = thit->localPosition();
02244           error = thit->localPositionError();
02245           Mposition = topol.measurementPosition(position);
02246           Merror = topol.measurementError(position,error);
02247 
02248           //      LocalVector drift= driftDirection(stripdet);
02249           LocalVector drift = stripcpe->driftDirection(stripdet);
02250           float thickness=stripdet->surface().bounds().thickness();
02251           rechitsasthickness = thickness;
02252           //cout<<"thickness = "<<thickness<<endl;
02253           float pitch = topol.localPitch(position);
02254           //cout<<"Valid:pitch = "<<pitch<<endl;
02255           float tanalpha = tan(anglealpha/57.3);
02256           //cout<<"Valid:tanalpha = "<<tanalpha<<endl;
02257           float tanalphaL = drift.x()/drift.z();
02258           //cout<<"Validstereo:drift.x() = "<<drift.x()<<endl;
02259           //cout<<"Valid:drift.z() = "<<drift.z()<<endl;
02260           //cout<<"Valid:tanalphaL = "<<tanalphaL<<endl;
02261           Wtrack = fabs((thickness/pitch)*tanalpha - (thickness/pitch)*tanalphaL);
02262           //cout<<"Valid:Wtrack = "<<Wtrack<<endl;
02263           float SLorentz = 0.5*(thickness/pitch)*tanalphaL;
02264           //int nstrips = topol.nstrips(); 
02265           int Sp = int(position.x()/pitch+SLorentz+0.5*Wtrack);
02266           int Sm = int(position.x()/pitch+SLorentz-0.5*Wtrack);
02267           Wexp = 1+Sp-Sm;
02268 
02269           clusiz=0;
02270           totcharge=0;
02271           clusiz = cluster->amplitudes().size();
02272           const std::vector<uint8_t> amplitudes=cluster->amplitudes();
02273           for(size_t ia=0; ia<amplitudes.size();ia++){
02274             totcharge+=amplitudes[ia];
02275           }
02276           rechitsasx = position.x();
02277           rechitsasy = position.y();
02278           rechitsasz = position.z();
02279           rechitsaserrxLF = error.xx();
02280           //cout<<"rechitsaserrxLF = "<<rechitsaserrxLF<<endl;
02281           rechitsaserrxMF = Merror.uu();
02282           //cout<<"rechitsaserrxMF simple hit= "<<sqrt(rechitsaserrxMF)<<endl;
02283           clusizsas = clusiz;
02284           cluchgsas = totcharge;
02285 
02286           //Association of the rechit to the simhit
02287           mindist = 999999;
02288           matched.clear();  
02289           matched = associate.associateHit(*hit2d);
02290           if(!matched.empty()){
02291             //            cout << "\t\t\tmatched  " << matched.size() << endl;
02292             for(vector<PSimHit>::const_iterator m=matched.begin(); m<matched.end(); m++){
02293               dist = abs((hit2d)->localPosition().x() - (*m).localPosition().x());
02294               if(dist<mindist){
02295                 mindist = dist;
02296                 closest = (*m);
02297               }
02298 
02299               rechitsasresLF = rechitsasx - closest.localPosition().x();
02300               rechitsasresMF = Mposition.x() - (topol.measurementPosition(closest.localPosition())).x();
02301               rechitsaspullLF = (thit->localPosition().x() - (closest).localPosition().x())/sqrt(error.xx());
02302               rechitsaspullMF = rechitsasresMF/sqrt(rechitsaserrxMF);
02303 
02304             }
02305           }
02306           rechitsastrackangle = anglealpha;
02307           rechitsastrackanglebeta = anglebeta;
02308           rechitsastrackwidth = Wtrack;
02309           rechitsasexpectedwidth = Wexp;
02310 
02311           clusterWidth = clusiz;
02312           unsigned int iopt;
02313           if (clusterWidth > Wexp + 2) {
02314             iopt = 1;
02315           } else if (Wexp == 1) {
02316             iopt = 2;
02317           } else if (clusterWidth <= Wexp) {
02318             iopt = 3;
02319           } else {
02320             iopt = 4;
02321           }
02322           rechitsascategory = iopt;
02323         }
02324         //isrechitsas = 0;
02325 
02326       }
02327 
02328       //Filling Histograms for simple hits
02329       //cout<<"isrechitrphi,isrechitsas = "<<isrechitrphi<<","<<isrechitsas<<endl;
02330 
02331       float CutThickness=0.04;
02332       CutThickness=0.;
02333 
02334       if(isrechitrphi>0 || isrechitsas>0){
02335 
02336         
02337         if (isrechitrphi>0) {
02338           
02339           //cout<<"rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02340           /*
02341           if (rechitrphithickness > CutThickness)
02342             {
02343                       PullvsTrackwidth->Fill(rechitrphitrackwidth,rechitrphipullMF);
02344                       
02345               if (clusizrphi ==2 && rechitrphiexpectedwidth == 1 && rechitrphitrackwidth<0.1) {
02346                 //Diff->Fill(-diff);
02347 
02348                 //              if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))) {
02349                 //SecondStrip->Fill(secondstrip);
02350                 //              }
02351               }
02352               //              Diff->Fill(-diff);
02353               
02354               //PositionSHx->Fill(positionshx);
02355 
02356               //    ErrxMF->Fill(sqrt(rechitrphierrxMF));
02357               //cout<<"ICI1:rechitrphitrackwidth = "<<rechitrphitrackwidth<<endl;
02358               //ErrxMFvsTrackwidth->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02359               ResMFvsTrackwidth->Fill(rechitrphitrackwidth,rechitrphiresMF);
02360               
02361               PullvsClusterwidth->Fill(clusizrphi,rechitrphipullMF);
02362               PullvsExpectedwidth->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02363               PullvsTrackangle->Fill(rechitrphitrackangle,rechitrphipullMF);
02364               PullvsTrackanglebeta->Fill(rechitrphitrackanglebeta,rechitrphipullMF);
02365              
02366             }
02367           */
02368           
02369           meCategory->Fill(rechitrphicategory);
02370           meTrackwidth->Fill(rechitrphitrackwidth);
02371           meExpectedwidth->Fill(rechitrphiexpectedwidth);
02372           meClusterwidth->Fill(clusizrphi);
02373           meTrackanglealpha->Fill(rechitrphitrackangle);
02374           meTrackanglebeta->Fill(rechitrphitrackanglebeta);
02375 
02376           meErrxMFAngleProfile->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02377           meErrxMFTrackwidthProfile->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02378 
02379           if (clusizrphi == 1) {
02380             meErrxMFTrackwidthProfileWClus1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02381             meResMFTrackwidthProfileWClus1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02382             if (rechitrphithickness > CutThickness)
02383               {
02384                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02385                 //{
02386                 /*
02387                 ResMFvsTrackwidthWClus1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02388                     if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus1Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02389                     if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus1Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02390                     if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus1Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02391                     if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus1Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02392                     ErrxMFvsTrackwidthWClus1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02393                 */
02394                     //}
02395               }
02396           }
02397           if (clusizrphi == 2) {
02398             meErrxMFTrackwidthProfileWClus2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02399             meResMFTrackwidthProfileWClus2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02400             meResMFTrackwidthProfileWClus21->Fill(rechitrphitrackwidth,rechitrphiresMF);
02401             meResMFTrackwidthProfileWClus22->Fill(rechitrphitrackwidth,rechitrphiresMF);
02402             meResMFTrackwidthProfileWClus23->Fill(rechitrphitrackwidth,rechitrphiresMF);
02403             if (rechitrphithickness > CutThickness)
02404               {
02405                 //              if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02406                 //{
02407                 if ((detid.subdetId() == int(StripSubdetector::TID)) || (detid.subdetId() == int(StripSubdetector::TEC))){
02408                   /*    ResMFvsTrackwidthWClus2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02409                 if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus2Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02410                 if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus2Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02411                 if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus2Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02412                 if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus2Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);*/
02413                 }
02414                 //          meResMFTrackwidthProfileWClus22->Fill(rechitrphitrackwidth,rechitrphiresMF);
02415                 //cout<<"ICI2:rechitrphitrackwidth = "<<rechitrphitrackwidth<<endl;
02416 
02417                 //ErrxMFvsTrackwidthWClus2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02418                     // }
02419               }
02420           }
02421           if (clusizrphi == 3) {
02422             meErrxMFTrackwidthProfileWClus3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02423             meResMFTrackwidthProfileWClus3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02424             if (rechitrphithickness > CutThickness)
02425               {
02426                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02427                 //{
02428                 /*
02429                 ResMFvsTrackwidthWClus3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02430                 if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus3Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02431                 if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus3Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02432                 if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus3Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02433                 if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus3Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02434                 ErrxMFvsTrackwidthWClus3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02435                 */
02436                 //  }
02437               }
02438           }
02439           if (clusizrphi == 4) {
02440             meErrxMFTrackwidthProfileWClus4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02441             meResMFTrackwidthProfileWClus4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02442             if (rechitrphithickness > CutThickness)
02443               {
02444                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02445                 //{
02446                 /*      ResMFvsTrackwidthWClus4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02447                 if (rechitrphiexpectedwidth==1) ResMFvsTrackwidthWClus4Wexp1->Fill(rechitrphitrackwidth,rechitrphiresMF);
02448                 if (rechitrphiexpectedwidth==2) ResMFvsTrackwidthWClus4Wexp2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02449                 if (rechitrphiexpectedwidth==3) ResMFvsTrackwidthWClus4Wexp3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02450                 if (rechitrphiexpectedwidth==4) ResMFvsTrackwidthWClus4Wexp4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02451                 ErrxMFvsTrackwidthWClus4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));*/
02452                     //}
02453               }
02454           }
02455           
02456           if (rechitrphicategory == 1) {
02457             meErrxMFTrackwidthProfileCategory1->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02458             meErrxMFClusterwidthProfileCategory1->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02459           }
02460           if (rechitrphicategory == 2) {
02461             meErrxMFTrackwidthProfileCategory2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02462             //ResMFvsTrackwidthCategory2->Fill(rechitrphitrackwidth,rechitrphiresMF);
02463             //  ErrxMFvsTrackwidthCategory2->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02464           }
02465           if (rechitrphicategory == 3) {
02466             meErrxMFTrackwidthProfileCategory3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02467             //ResMFvsTrackwidthCategory3->Fill(rechitrphitrackwidth,rechitrphiresMF);
02468             //ErrxMFvsTrackwidthCategory3->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02469           }
02470           if (rechitrphicategory == 4) {
02471             meErrxMFTrackwidthProfileCategory4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02472             //ResMFvsTrackwidthCategory4->Fill(rechitrphitrackwidth,rechitrphiresMF);
02473             //ErrxMFvsTrackwidthCategory4->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02474           }
02475           //const unsigned int NBINS = meErrxMFTrackwidthProfile->getNbinsX();
02476           //cout<<"NBINS2 = "<<NBINS<<endl;
02477           
02478           meErrxMF->Fill(sqrt(rechitrphierrxMF));
02479           //const unsigned int NBINS3 = meErrxMF->getNbinsX();
02480           //cout<<"NBINS3 = "<<NBINS<<endl;
02481           meErrxLF->Fill(sqrt(rechitrphierrxLF));
02482           meResMF->Fill(rechitrphiresMF);
02483           meResLF->Fill(rechitrphiresLF);
02484           mePullMF->Fill(rechitrphipullMF);
02485           mePullLF->Fill(rechitrphipullLF);
02486           
02487         }
02488 
02489         if (isrechitsas>0) {
02490           
02491           if (rechitsasthickness > CutThickness)
02492             {
02493               /*
02494                       PullvsTrackwidth->Fill(rechitsastrackwidth,rechitsaspullMF);
02495                       //cout<<"rechitsaserrxMF"<<rechitsaserrxMF<<endl;
02496                       // ErrxMF->Fill(sqrt(rechitsaserrxMF));
02497               ErrxMFvsTrackwidth->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02498               ResMFvsTrackwidth->Fill(rechitsastrackwidth,rechitsasresMF);
02499 
02500               
02501               PullvsClusterwidth->Fill(clusizsas,rechitsaspullMF);
02502               PullvsExpectedwidth->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02503               PullvsTrackangle->Fill(rechitsastrackangle,rechitsaspullMF);
02504               PullvsTrackanglebeta->Fill(rechitsastrackanglebeta,rechitsaspullMF);
02505               */
02506             }
02507           
02508           
02509           meCategory->Fill(rechitsascategory);
02510           meTrackwidth->Fill(rechitsastrackwidth);
02511           meExpectedwidth->Fill(rechitsasexpectedwidth);
02512           meClusterwidth->Fill(clusizsas);
02513           meTrackanglealpha->Fill(rechitsastrackangle);
02514           meTrackanglebeta->Fill(rechitsastrackanglebeta);
02515           
02516           meErrxMFAngleProfile->Fill(rechitsastrackangle,sqrt(rechitsaserrxMF));
02517           meErrxMFTrackwidthProfile->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02518           
02519           if (clusizsas == 1) {
02520             meErrxMFTrackwidthProfileWClus1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02521             meResMFTrackwidthProfileWClus1->Fill(rechitsastrackwidth,rechitsasresMF);
02522             if (rechitsasthickness > CutThickness)
02523               {
02524                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02525                 //{
02526                 /*  
02527                 ResMFvsTrackwidthWClus1->Fill(rechitsastrackwidth,rechitsasresMF);
02528                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus1Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02529                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus1Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02530                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus1Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02531                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus1Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02532                 ErrxMFvsTrackwidthWClus1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02533                 */
02534                        //}
02535               }
02536           }
02537           
02538           if (clusizsas == 2) {
02539             meErrxMFTrackwidthProfileWClus2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02540             meResMFTrackwidthProfileWClus2->Fill(rechitsastrackwidth,rechitsasresMF);
02541             if (rechitsasthickness > CutThickness)
02542               {
02543                 //              if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02544                 //{
02545                 /*
02546                 ResMFvsTrackwidthWClus2->Fill(rechitsastrackwidth,rechitsasresMF);
02547                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus2Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02548                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus2Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02549                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus2Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02550                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus2Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02551                 ErrxMFvsTrackwidthWClus2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02552                 */
02553                     //}
02554               }
02555           }
02556           if (clusizsas == 3) {
02557             meErrxMFTrackwidthProfileWClus3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02558             meResMFTrackwidthProfileWClus3->Fill(rechitsastrackwidth,rechitsasresMF);
02559             if (rechitsasthickness > CutThickness)
02560               {
02561                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02562                 // {
02563                 /*
02564                 ResMFvsTrackwidthWClus3->Fill(rechitsastrackwidth,rechitsasresMF);
02565                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus3Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02566                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus3Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02567                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus3Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02568                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus3Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02569                 ErrxMFvsTrackwidthWClus3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02570                 */
02571                 //}
02572               }
02573           }
02574           if (clusizsas == 4) {
02575             meErrxMFTrackwidthProfileWClus4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02576             meResMFTrackwidthProfileWClus4->Fill(rechitsastrackwidth,rechitsasresMF);
02577             if (rechitsasthickness > CutThickness)
02578               {
02579                 //if ((detid.subdetId() == int(StripSubdetector::TIB)) || (detid.subdetId() == int(StripSubdetector::TOB)))
02580                 //{
02581                 /*
02582                 ResMFvsTrackwidthWClus4->Fill(rechitsastrackwidth,rechitsasresMF);
02583                 if (rechitsasexpectedwidth==1) ResMFvsTrackwidthWClus4Wexp1->Fill(rechitsastrackwidth,rechitsasresMF);
02584                 if (rechitsasexpectedwidth==2) ResMFvsTrackwidthWClus4Wexp2->Fill(rechitsastrackwidth,rechitsasresMF);
02585                 if (rechitsasexpectedwidth==3) ResMFvsTrackwidthWClus4Wexp3->Fill(rechitsastrackwidth,rechitsasresMF);
02586                 if (rechitsasexpectedwidth==4) ResMFvsTrackwidthWClus4Wexp4->Fill(rechitsastrackwidth,rechitsasresMF);
02587                 ErrxMFvsTrackwidthWClus4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02588                 */
02589                     // }
02590               }
02591           }
02592           if (rechitsascategory == 1) {
02593             meErrxMFTrackwidthProfileCategory1->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02594             meErrxMFClusterwidthProfileCategory1->Fill(clusizsas,sqrt(rechitsaserrxMF));
02595           }
02596           if (rechitsascategory == 2) {
02597             meErrxMFTrackwidthProfileCategory2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02598             //ResMFvsTrackwidthCategory2->Fill(rechitsastrackwidth,rechitsasresMF);
02599             //ErrxMFvsTrackwidthCategory2->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02600           }
02601           if (rechitsascategory == 3) {
02602             meErrxMFTrackwidthProfileCategory3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02603             //ResMFvsTrackwidthCategory3->Fill(rechitsastrackwidth,rechitsasresMF);
02604             //ErrxMFvsTrackwidthCategory3->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02605           }
02606           if (rechitsascategory == 4) {
02607             meErrxMFTrackwidthProfileCategory4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02608             //ResMFvsTrackwidthCategory4->Fill(rechitsastrackwidth,rechitsasresMF);
02609             //ErrxMFvsTrackwidthCategory4->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02610           }
02611           
02612           meErrxMF->Fill(sqrt(rechitsaserrxMF));
02613           meErrxLF->Fill(sqrt(rechitsaserrxLF));
02614           meResMF->Fill(rechitsasresMF);
02615           meResLF->Fill(rechitsasresLF);
02616           mePullMF->Fill(rechitsaspullMF);
02617           mePullLF->Fill(rechitsaspullLF);
02618            
02619         }
02620 
02621         
02622         if (detid.subdetId() == int(StripSubdetector::TIB)){
02623           TIBDetId tibid(myid);
02624           int Tibisrechitrphi    = isrechitrphi;
02625           int Tibisrechitsas     = isrechitsas;
02626           //cout<<"Tibisrechitrphi,Tibisrechitsas = "<<Tibisrechitrphi<<" "<<Tibisrechitsas<<endl;
02627           int ilay = tibid.layer() - 1; //for histogram filling
02628           //cout<<"ilay1 = "<<ilay<<endl;
02629           if(Tibisrechitrphi!=0){
02630             if (rechitrphithickness > CutThickness)
02631               {
02632                 /*PullvsTrackwidthTIB->Fill(rechitrphitrackwidth,rechitrphipullMF);
02633                 PullvsClusterwidthTIB->Fill(clusizrphi,rechitrphipullMF);
02634                 PullvsExpectedwidthTIB->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02635                 PullvsTrackangleTIB->Fill(rechitrphitrackangle,rechitrphipullMF);
02636                 PullvsTrackanglebetaTIB->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02637               }
02638             //cout<<"TIB:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02639             //cout<<"ilay2 = "<<ilay<<endl;
02640             //cout<<"je suis la RPHI"<<endl;
02641             meNstpRphiTIB[ilay]->Fill(clusizrphi);
02642             meAdcRphiTIB[ilay]->Fill(cluchgrphi);
02643             mePosxRphiTIB[ilay]->Fill(rechitrphix);
02644             meErrxLFRphiTIB[ilay]->Fill(sqrt(rechitrphierrxLF));
02645             meErrxMFRphiTIB[ilay]->Fill(sqrt(rechitrphierrxMF));
02646             meResLFRphiTIB[ilay]->Fill(rechitrphiresLF);
02647             meResMFRphiTIB[ilay]->Fill(rechitrphiresMF);
02648             mePullLFRphiTIB[ilay]->Fill(rechitrphipullLF);
02649             mePullMFRphiTIB[ilay]->Fill(rechitrphipullMF);
02650             meTrackangleRphiTIB[ilay]->Fill(rechitrphitrackangle);
02651             mePullTrackangleProfileRphiTIB[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02652             mePullTrackwidthProfileRphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02653             if (clusizrphi == 1) {
02654               meErrxMFTrackwidthProfileWclus1RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02655               meResMFTrackwidthProfileWclus1RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02656             }
02657             if (clusizrphi == 2) {
02658               meErrxMFTrackwidthProfileWclus2RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02659               meResMFTrackwidthProfileWclus2RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02660             }
02661             if (clusizrphi == 3) {
02662               meErrxMFTrackwidthProfileWclus3RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02663               meResMFTrackwidthProfileWclus3RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02664             }
02665             if (clusizrphi == 4) {
02666               meErrxMFTrackwidthProfileWclus4RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02667               meResMFTrackwidthProfileWclus4RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02668             }
02669 
02670 
02671             if (rechitrphicategory == 1) {
02672               mePullTrackwidthProfileCategory1RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02673               meErrxMFTrackwidthProfileCategory1RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02674               meErrxMFClusterwidthProfileCategory1RphiTIB[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02675             }
02676             if (rechitrphicategory == 2) {
02677               mePullTrackwidthProfileCategory2RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02678               meErrxMFTrackwidthProfileCategory2RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02679             }
02680             if (rechitrphicategory == 3) {
02681               mePullTrackwidthProfileCategory3RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02682               meErrxMFTrackwidthProfileCategory3RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02683             }
02684             if (rechitrphicategory == 4) {
02685               mePullTrackwidthProfileCategory4RphiTIB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02686               meErrxMFTrackwidthProfileCategory4RphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02687             }
02688             meTrackwidthRphiTIB[ilay]->Fill(rechitrphitrackwidth);
02689             meExpectedwidthRphiTIB[ilay]->Fill(rechitrphiexpectedwidth);
02690             meClusterwidthRphiTIB[ilay]->Fill(clusizrphi);
02691             meCategoryRphiTIB[ilay]->Fill(rechitrphicategory);
02692             meErrxMFTrackwidthProfileRphiTIB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02693             meErrxMFAngleProfileRphiTIB[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02694           }
02695           if(Tibisrechitsas!=0){
02696             if (rechitsasthickness > CutThickness)
02697               {
02698                 /*      PullvsTrackwidthTIB->Fill(rechitsastrackwidth,rechitsaspullMF);
02699                 PullvsClusterwidthTIB->Fill(clusizsas,rechitsaspullMF);
02700                 PullvsExpectedwidthTIB->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02701                 PullvsTrackangleTIB->Fill(rechitsastrackangle,rechitsaspullMF);
02702                 PullvsTrackanglebetaTIB->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
02703               }
02704             meNstpSasTIB[ilay]->Fill(clusizsas);
02705             meAdcSasTIB[ilay]->Fill(cluchgsas);
02706             mePosxSasTIB[ilay]->Fill(rechitsasx);
02707             meErrxLFSasTIB[ilay]->Fill(sqrt(rechitsaserrxLF));
02708             meResLFSasTIB[ilay]->Fill(rechitsasresLF);
02709             mePullLFSasTIB[ilay]->Fill(rechitsaspullLF);
02710             meErrxMFSasTIB[ilay]->Fill(sqrt(rechitsaserrxMF));
02711             meResMFSasTIB[ilay]->Fill(rechitsasresMF);
02712             mePullMFSasTIB[ilay]->Fill(rechitsaspullMF);
02713             meTrackangleSasTIB[ilay]->Fill(rechitsastrackangle);
02714             mePullTrackangleProfileSasTIB[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02715             mePullTrackwidthProfileSasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02716             if (rechitsascategory == 1) {
02717               mePullTrackwidthProfileCategory1SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02718               meErrxMFTrackwidthProfileCategory1SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02719               meErrxMFClusterwidthProfileCategory1SasTIB[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02720             }
02721             if (rechitsascategory == 2) {
02722               mePullTrackwidthProfileCategory2SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02723               meErrxMFTrackwidthProfileCategory2SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02724             }
02725             if (rechitsascategory == 3) {
02726               mePullTrackwidthProfileCategory3SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02727               meErrxMFTrackwidthProfileCategory3SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02728             }
02729             if (rechitsascategory == 4) {
02730               mePullTrackwidthProfileCategory4SasTIB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02731               meErrxMFTrackwidthProfileCategory4SasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02732             }
02733             meTrackwidthSasTIB[ilay]->Fill(rechitsastrackwidth);
02734             meExpectedwidthSasTIB[ilay]->Fill(rechitsasexpectedwidth);
02735             meClusterwidthSasTIB[ilay]->Fill(clusizsas);
02736             meCategorySasTIB[ilay]->Fill(rechitsascategory);
02737             meErrxMFTrackwidthProfileSasTIB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02738             meErrxMFAngleProfileSasTIB[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02739           }
02740         }
02741         
02742         if (detid.subdetId() == int(StripSubdetector::TOB)){
02743           TOBDetId tobid(myid);
02744           int Tobisrechitrphi    = isrechitrphi;
02745           int Tobisrechitsas     = isrechitsas;
02746           int ilay = tobid.layer() - 1; //for histogram filling
02747           if(Tobisrechitrphi!=0){
02748             if (rechitrphithickness > CutThickness)
02749               {
02750                 /*PullvsTrackwidthTOB->Fill(rechitrphitrackwidth,rechitrphipullMF);
02751                 PullvsClusterwidthTOB->Fill(clusizrphi,rechitrphipullMF);
02752                 PullvsExpectedwidthTOB->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02753                 PullvsTrackangleTOB->Fill(rechitrphitrackangle,rechitrphipullMF);
02754                 PullvsTrackanglebetaTOB->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02755               }
02756             //cout<<"TOB:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02757             meNstpRphiTOB[ilay]->Fill(clusizrphi);
02758             meAdcRphiTOB[ilay]->Fill(cluchgrphi);
02759             mePosxRphiTOB[ilay]->Fill(rechitrphix);
02760             meErrxLFRphiTOB[ilay]->Fill(sqrt(rechitrphierrxLF));
02761             meResLFRphiTOB[ilay]->Fill(rechitrphiresLF);
02762             mePullLFRphiTOB[ilay]->Fill(rechitrphipullLF);
02763             meErrxMFRphiTOB[ilay]->Fill(sqrt(rechitrphierrxMF));
02764             meResMFRphiTOB[ilay]->Fill(rechitrphiresMF);
02765             mePullMFRphiTOB[ilay]->Fill(rechitrphipullMF);
02766             meTrackangleRphiTOB[ilay]->Fill(rechitrphitrackangle);
02767             mePullTrackangleProfileRphiTOB[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02768             mePullTrackwidthProfileRphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02769 
02770             if (clusizrphi == 1) {
02771               meErrxMFTrackwidthProfileWclus1RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02772               meResMFTrackwidthProfileWclus1RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02773             }
02774             if (clusizrphi == 2) {
02775               meErrxMFTrackwidthProfileWclus2RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02776               meResMFTrackwidthProfileWclus2RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02777             }
02778             if (clusizrphi == 3) {
02779               meErrxMFTrackwidthProfileWclus3RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02780               meResMFTrackwidthProfileWclus3RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02781             }
02782             if (clusizrphi == 4) {
02783               meErrxMFTrackwidthProfileWclus4RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02784               meResMFTrackwidthProfileWclus4RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphiresMF);
02785             }
02786 
02787 
02788             if (rechitrphicategory == 1) {
02789               mePullTrackwidthProfileCategory1RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02790               meErrxMFTrackwidthProfileCategory1RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02791               meErrxMFClusterwidthProfileCategory1RphiTOB[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02792             }
02793             if (rechitrphicategory == 2) {
02794               mePullTrackwidthProfileCategory2RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02795               meErrxMFTrackwidthProfileCategory2RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02796             }
02797             if (rechitrphicategory == 3) {
02798               mePullTrackwidthProfileCategory3RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02799               meErrxMFTrackwidthProfileCategory3RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02800             }
02801             if (rechitrphicategory == 4) {
02802               mePullTrackwidthProfileCategory4RphiTOB[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02803               meErrxMFTrackwidthProfileCategory4RphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02804             }
02805             meTrackwidthRphiTOB[ilay]->Fill(rechitrphitrackwidth);
02806             meExpectedwidthRphiTOB[ilay]->Fill(rechitrphiexpectedwidth);
02807             meClusterwidthRphiTOB[ilay]->Fill(clusizrphi);
02808             meCategoryRphiTOB[ilay]->Fill(rechitrphicategory);
02809             meErrxMFTrackwidthProfileRphiTOB[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02810             meErrxMFAngleProfileRphiTOB[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02811           } 
02812           if(Tobisrechitsas!=0){
02813             if (rechitsasthickness > CutThickness)
02814               {/*
02815                 PullvsTrackwidthTOB->Fill(rechitsastrackwidth,rechitsaspullMF);
02816                 PullvsClusterwidthTOB->Fill(clusizsas,rechitsaspullMF);
02817                 PullvsExpectedwidthTOB->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02818                 PullvsTrackangleTOB->Fill(rechitsastrackangle,rechitsaspullMF);
02819                 PullvsTrackanglebetaTOB->Fill(rechitsastrackanglebeta,rechitsaspullMF);
02820                */
02821               }
02822             meNstpSasTOB[ilay]->Fill(clusizsas);
02823             meAdcSasTOB[ilay]->Fill(cluchgsas);
02824             mePosxSasTOB[ilay]->Fill(rechitsasx);
02825             meErrxLFSasTOB[ilay]->Fill(sqrt(rechitsaserrxLF));
02826             meResLFSasTOB[ilay]->Fill(rechitsasresLF);
02827             mePullLFSasTOB[ilay]->Fill(rechitsaspullLF);
02828             meErrxMFSasTOB[ilay]->Fill(sqrt(rechitsaserrxMF));
02829             meResMFSasTOB[ilay]->Fill(rechitsasresMF);
02830             mePullMFSasTOB[ilay]->Fill(rechitsaspullMF);
02831             meTrackangleSasTOB[ilay]->Fill(rechitsastrackangle);
02832             mePullTrackangleProfileSasTOB[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02833             mePullTrackwidthProfileSasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02834             if (rechitsascategory == 1) {
02835               mePullTrackwidthProfileCategory1SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02836               meErrxMFTrackwidthProfileCategory1SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02837               meErrxMFClusterwidthProfileCategory1SasTOB[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02838             }
02839             if (rechitsascategory == 2) {
02840               mePullTrackwidthProfileCategory2SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02841               meErrxMFTrackwidthProfileCategory2SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02842             }
02843             if (rechitsascategory == 3) {
02844               mePullTrackwidthProfileCategory3SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02845               meErrxMFTrackwidthProfileCategory3SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02846             }
02847             if (rechitsascategory == 4) {
02848               mePullTrackwidthProfileCategory4SasTOB[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02849               meErrxMFTrackwidthProfileCategory4SasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02850             }
02851             meTrackwidthSasTOB[ilay]->Fill(rechitsastrackwidth);
02852             meExpectedwidthSasTOB[ilay]->Fill(rechitsasexpectedwidth);
02853             meClusterwidthSasTOB[ilay]->Fill(clusizsas);
02854             meCategorySasTOB[ilay]->Fill(rechitsascategory);
02855             meErrxMFTrackwidthProfileSasTOB[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02856             meErrxMFAngleProfileSasTOB[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02857           }
02858         }
02859         
02860         if (detid.subdetId() == int(StripSubdetector::TID)){
02861           TIDDetId tidid(myid);
02862           int Tidisrechitrphi    = isrechitrphi;
02863           int Tidisrechitsas     = isrechitsas;
02864           int ilay = tidid.ring() - 1; //for histogram filling
02865           if(Tidisrechitrphi!=0){
02866             if (rechitrphithickness > CutThickness)
02867               {
02868                 /*PullvsTrackwidthTID->Fill(rechitrphitrackwidth,rechitrphipullMF);
02869                 PullvsClusterwidthTID->Fill(clusizrphi,rechitrphipullMF);
02870                 PullvsExpectedwidthTID->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02871                 PullvsTrackangleTID->Fill(rechitrphitrackangle,rechitrphipullMF);
02872                 PullvsTrackanglebetaTID->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02873               }
02874             //cout<<"TID:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02875             meNstpRphiTID[ilay]->Fill(clusizrphi);
02876             meAdcRphiTID[ilay]->Fill(cluchgrphi);
02877             mePosxRphiTID[ilay]->Fill(rechitrphix);
02878             meErrxLFRphiTID[ilay]->Fill(sqrt(rechitrphierrxLF));
02879             meResLFRphiTID[ilay]->Fill(rechitrphiresLF);
02880             mePullLFRphiTID[ilay]->Fill(rechitrphipullLF);
02881             meErrxMFRphiTID[ilay]->Fill(sqrt(rechitrphierrxMF));
02882             meResMFRphiTID[ilay]->Fill(rechitrphiresMF);
02883             mePullMFRphiTID[ilay]->Fill(rechitrphipullMF);
02884             meTrackangleRphiTID[ilay]->Fill(rechitrphitrackangle);
02885             mePullTrackangleProfileRphiTID[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02886             mePullTrackwidthProfileRphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02887             if (rechitrphicategory == 1) {
02888               mePullTrackwidthProfileCategory1RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02889               meErrxMFTrackwidthProfileCategory1RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02890               meErrxMFClusterwidthProfileCategory1RphiTID[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02891             }
02892             if (rechitrphicategory == 2) {
02893               mePullTrackwidthProfileCategory2RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02894               meErrxMFTrackwidthProfileCategory2RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02895             }
02896             if (rechitrphicategory == 3) {
02897               mePullTrackwidthProfileCategory3RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02898               meErrxMFTrackwidthProfileCategory3RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02899             }
02900             if (rechitrphicategory == 4) {
02901               mePullTrackwidthProfileCategory4RphiTID[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02902               meErrxMFTrackwidthProfileCategory4RphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02903             }
02904             meTrackwidthRphiTID[ilay]->Fill(rechitrphitrackwidth);
02905             meExpectedwidthRphiTID[ilay]->Fill(rechitrphiexpectedwidth);
02906             meClusterwidthRphiTID[ilay]->Fill(clusizrphi);
02907             meCategoryRphiTID[ilay]->Fill(rechitrphicategory);
02908             meErrxMFTrackwidthProfileRphiTID[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02909             meErrxMFAngleProfileRphiTID[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
02910           } 
02911           if(Tidisrechitsas!=0){
02912             if (rechitsasthickness > CutThickness)
02913               {
02914                 /*PullvsTrackwidthTID->Fill(rechitsastrackwidth,rechitsaspullMF);
02915                 PullvsClusterwidthTID->Fill(clusizsas,rechitsaspullMF);
02916                 PullvsExpectedwidthTID->Fill(rechitsasexpectedwidth,rechitsaspullMF);
02917                 PullvsTrackangleTID->Fill(rechitsastrackangle,rechitsaspullMF);
02918                 PullvsTrackanglebetaTID->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
02919               }
02920             meNstpSasTID[ilay]->Fill(clusizsas);
02921             meAdcSasTID[ilay]->Fill(cluchgsas);
02922             mePosxSasTID[ilay]->Fill(rechitsasx);
02923             meErrxLFSasTID[ilay]->Fill(sqrt(rechitsaserrxLF));
02924             meResLFSasTID[ilay]->Fill(rechitsasresLF);
02925             mePullLFSasTID[ilay]->Fill(rechitsaspullLF);
02926             meErrxMFSasTID[ilay]->Fill(sqrt(rechitsaserrxMF));
02927             meResMFSasTID[ilay]->Fill(rechitsasresMF);
02928             mePullMFSasTID[ilay]->Fill(rechitsaspullMF);
02929             meTrackangleSasTID[ilay]->Fill(rechitsastrackangle);
02930             mePullTrackangleProfileSasTID[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
02931             mePullTrackwidthProfileSasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02932             if (rechitsascategory == 1) {
02933               mePullTrackwidthProfileCategory1SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02934               meErrxMFTrackwidthProfileCategory1SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02935               meErrxMFClusterwidthProfileCategory1SasTID[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
02936             }
02937             if (rechitsascategory == 2) {
02938               mePullTrackwidthProfileCategory2SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02939               meErrxMFTrackwidthProfileCategory2SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02940             }
02941             if (rechitsascategory == 3) {
02942               mePullTrackwidthProfileCategory3SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02943               meErrxMFTrackwidthProfileCategory3SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02944             }
02945             if (rechitsascategory == 4) {
02946               mePullTrackwidthProfileCategory4SasTID[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
02947               meErrxMFTrackwidthProfileCategory4SasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02948             }
02949             meTrackwidthSasTID[ilay]->Fill(rechitsastrackwidth);
02950             meExpectedwidthSasTID[ilay]->Fill(rechitsasexpectedwidth);
02951             meClusterwidthSasTID[ilay]->Fill(clusizsas);
02952             meCategorySasTID[ilay]->Fill(rechitsascategory);
02953             meErrxMFTrackwidthProfileSasTID[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
02954             meErrxMFAngleProfileSasTID[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
02955           }
02956         }
02957               
02958         if (detid.subdetId() == int(StripSubdetector::TEC)){
02959           TECDetId tecid(myid);
02960           int Tecisrechitrphi    = isrechitrphi;
02961           int Tecisrechitsas     = isrechitsas;
02962           int ilay = tecid.ring() - 1; //for histogram filling
02963           if(Tecisrechitrphi!=0){
02964             if (rechitrphithickness > CutThickness)
02965               {
02966                 /*PullvsTrackwidthTEC->Fill(rechitrphitrackwidth,rechitrphipullMF);
02967                 PullvsClusterwidthTEC->Fill(clusizrphi,rechitrphipullMF);
02968                 PullvsExpectedwidthTEC->Fill(rechitrphiexpectedwidth,rechitrphipullMF);
02969                 PullvsTrackangleTEC->Fill(rechitrphitrackangle,rechitrphipullMF);
02970                 PullvsTrackanglebetaTEC->Fill(rechitrphitrackanglebeta,rechitrphipullMF);*/
02971               }
02972             //cout<<"TEC:rechitrphitrackwidth,rechitrphipullMF = "<<rechitrphitrackwidth<<" "<<rechitrphipullMF<<endl;
02973             meNstpRphiTEC[ilay]->Fill(clusizrphi);
02974             meAdcRphiTEC[ilay]->Fill(cluchgrphi);
02975             mePosxRphiTEC[ilay]->Fill(rechitrphix);
02976             meErrxLFRphiTEC[ilay]->Fill(sqrt(rechitrphierrxLF));
02977             meResLFRphiTEC[ilay]->Fill(rechitrphiresLF);
02978             mePullLFRphiTEC[ilay]->Fill(rechitrphipullLF);
02979             meErrxMFRphiTEC[ilay]->Fill(sqrt(rechitrphierrxMF));
02980             meResMFRphiTEC[ilay]->Fill(rechitrphiresMF);
02981             mePullMFRphiTEC[ilay]->Fill(rechitrphipullMF);
02982             meTrackangleRphiTEC[ilay]->Fill(rechitrphitrackangle);
02983             mePullTrackangleProfileRphiTEC[ilay]->Fill(rechitrphitrackangle,rechitrphipullMF);
02984             mePullTrackwidthProfileRphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02985             if (rechitrphicategory == 1) {
02986               mePullTrackwidthProfileCategory1RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02987               meErrxMFTrackwidthProfileCategory1RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02988               meErrxMFClusterwidthProfileCategory1RphiTEC[ilay]->Fill(clusizrphi,sqrt(rechitrphierrxMF));
02989             }
02990             if (rechitrphicategory == 2) {
02991               mePullTrackwidthProfileCategory2RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02992               meErrxMFTrackwidthProfileCategory2RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02993             }
02994             if (rechitrphicategory == 3) {
02995               mePullTrackwidthProfileCategory3RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
02996               meErrxMFTrackwidthProfileCategory3RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
02997             }
02998             if (rechitrphicategory == 4) {
02999               mePullTrackwidthProfileCategory4RphiTEC[ilay]->Fill(rechitrphitrackwidth,rechitrphipullMF);
03000               meErrxMFTrackwidthProfileCategory4RphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
03001             }
03002             meTrackwidthRphiTEC[ilay]->Fill(rechitrphitrackwidth);
03003             meExpectedwidthRphiTEC[ilay]->Fill(rechitrphiexpectedwidth);
03004             meClusterwidthRphiTEC[ilay]->Fill(clusizrphi);
03005             meCategoryRphiTEC[ilay]->Fill(rechitrphicategory);
03006             meErrxMFTrackwidthProfileRphiTEC[ilay]->Fill(rechitrphitrackwidth,sqrt(rechitrphierrxMF));
03007             meErrxMFAngleProfileRphiTEC[ilay]->Fill(rechitrphitrackangle,sqrt(rechitrphierrxMF));
03008           } 
03009           if(Tecisrechitsas!=0){
03010             if (rechitsasthickness > CutThickness)
03011               {
03012                 /*PullvsTrackwidthTEC->Fill(rechitsastrackwidth,rechitsaspullMF);
03013                 PullvsClusterwidthTEC->Fill(clusizsas,rechitsaspullMF);
03014                 PullvsExpectedwidthTEC->Fill(rechitsasexpectedwidth,rechitsaspullMF);
03015                 PullvsTrackangleTEC->Fill(rechitsastrackangle,rechitsaspullMF);
03016                 PullvsTrackanglebetaTEC->Fill(rechitsastrackanglebeta,rechitsaspullMF);*/
03017               }
03018             meNstpSasTEC[ilay]->Fill(clusizsas);
03019             meAdcSasTEC[ilay]->Fill(cluchgsas);
03020             mePosxSasTEC[ilay]->Fill(rechitsasx);
03021             meErrxLFSasTEC[ilay]->Fill(sqrt(rechitsaserrxLF));
03022             meResLFSasTEC[ilay]->Fill(rechitsasresLF);
03023             mePullLFSasTEC[ilay]->Fill(rechitsaspullLF);
03024             meErrxMFSasTEC[ilay]->Fill(sqrt(rechitsaserrxMF));
03025             meResMFSasTEC[ilay]->Fill(rechitsasresMF);
03026             mePullMFSasTEC[ilay]->Fill(rechitsaspullMF);
03027             meTrackangleSasTEC[ilay]->Fill(rechitsastrackangle);
03028             mePullTrackangleProfileSasTEC[ilay]->Fill(rechitsastrackangle,rechitsaspullMF);
03029             mePullTrackwidthProfileSasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
03030             if (rechitsascategory == 1) {
03031               mePullTrackwidthProfileCategory1SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
03032               meErrxMFTrackwidthProfileCategory1SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
03033               meErrxMFClusterwidthProfileCategory1SasTEC[ilay]->Fill(clusizsas,sqrt(rechitsaserrxMF));
03034             }
03035             if (rechitsascategory == 2) {
03036               mePullTrackwidthProfileCategory2SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
03037               meErrxMFTrackwidthProfileCategory2SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
03038             }
03039             if (rechitsascategory == 3) {
03040               mePullTrackwidthProfileCategory3SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
03041               meErrxMFTrackwidthProfileCategory3SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
03042             }
03043             if (rechitsascategory == 4) {
03044               mePullTrackwidthProfileCategory4SasTEC[ilay]->Fill(rechitsastrackwidth,rechitsaspullMF);
03045               meErrxMFTrackwidthProfileCategory4SasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
03046             }
03047             meTrackwidthSasTEC[ilay]->Fill(rechitsastrackwidth);
03048             meExpectedwidthSasTEC[ilay]->Fill(rechitsasexpectedwidth);
03049             meClusterwidthSasTEC[ilay]->Fill(clusizsas);
03050             meCategorySasTEC[ilay]->Fill(rechitsascategory);
03051             meErrxMFTrackwidthProfileSasTEC[ilay]->Fill(rechitsastrackwidth,sqrt(rechitsaserrxMF));
03052             meErrxMFAngleProfileSasTEC[ilay]->Fill(rechitsastrackangle,rechitsaserrxMF);
03053           }
03054         
03055         }
03056         
03057       } //simplehits
03058       //cout<<"DebugLine301"<<endl;
03059       
03060     }
03061     //cout<<"DebugLine302"<<endl;
03062     
03063   }
03064   //cout<<"DebugLine303"<<endl;
03065 
03066 }
03067 
03068 
03069 
03070   //needed by to do the residual for matched hits
03071 std::pair<LocalPoint,LocalVector> SiStripTrackingRecHitsValid::projectHit( const PSimHit& hit, const StripGeomDetUnit* stripDet, const BoundPlane& plane) 
03072 {
03073   //  const StripGeomDetUnit* stripDet = dynamic_cast<const StripGeomDetUnit*>(hit.det());
03074   //if (stripDet == 0) throw MeasurementDetException("HitMatcher hit is not on StripGeomDetUnit");
03075   
03076   const StripTopology& topol = stripDet->specificTopology();
03077   GlobalPoint globalpos= stripDet->surface().toGlobal(hit.localPosition());
03078   LocalPoint localHit = plane.toLocal(globalpos);
03079   //track direction
03080   LocalVector locdir=hit.localDirection();
03081   //rotate track in new frame
03082   
03083   GlobalVector globaldir= stripDet->surface().toGlobal(locdir);
03084   LocalVector dir=plane.toLocal(globaldir);
03085   float scale = -localHit.z() / dir.z();
03086   
03087   LocalPoint projectedPos = localHit + scale*dir;
03088   
03089   //  std::cout << "projectedPos " << projectedPos << std::endl;
03090   
03091   float selfAngle = topol.stripAngle( topol.strip( hit.localPosition()));
03092   
03093   LocalVector stripDir( sin(selfAngle), cos(selfAngle), 0); // vector along strip in hit frame
03094   
03095   LocalVector localStripDir( plane.toLocal(stripDet->surface().toGlobal( stripDir)));
03096   
03097   return std::pair<LocalPoint,LocalVector>( projectedPos, localStripDir);
03098 }