CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Alignment/OfflineValidation/plugins/MuonAlignmentAnalyzer.cc

Go to the documentation of this file.
00001 
00011 #include "Alignment/OfflineValidation/plugins/MuonAlignmentAnalyzer.h"
00012 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" 
00013 
00014 // Collaborating Class Header
00015 #include "FWCore/Framework/interface/MakerMacros.h"
00016 #include "FWCore/Framework/interface/Event.h"
00017 
00018 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00019 #include "boost/mpl/vector.hpp" 
00020 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00021 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00022 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00023 #include "DataFormats/DetId/interface/DetId.h"
00024 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
00025 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00026 #include "DataFormats/Math/interface/deltaR.h"
00027 
00028 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00029 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00030 #include "DataFormats/TrackReco/interface/Track.h"
00031 
00032 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00033 
00034 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
00035 #include "DataFormats/DTRecHit/interface/DTRecSegment4D.h"
00036 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00037 #include "DataFormats/CSCRecHit/interface/CSCSegment.h"
00038 #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
00039 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
00040 #include "DataFormats/GeometryVector/interface/GlobalVector.h" 
00041 
00042 #include "DataFormats/GeometrySurface/interface/Cylinder.h"
00043 #include "DataFormats/GeometrySurface/interface/Plane.h"
00044 #include "DataFormats/GeometrySurface/interface/Cone.h" 
00045 
00046 #include "TH2F.h"
00047 #include "TLorentzVector.h"
00048 
00050 MuonAlignmentAnalyzer::MuonAlignmentAnalyzer(const edm::ParameterSet& pset):
00051     hResidualLocalXDT_W(5),
00052     hResidualLocalPhiDT_W(5),
00053     hResidualLocalThetaDT_W(5),
00054     hResidualLocalYDT_W(5),     
00055     hResidualLocalXCSC_ME(18),
00056     hResidualLocalPhiCSC_ME(18),
00057     hResidualLocalThetaCSC_ME(18),
00058     hResidualLocalYCSC_ME(18),
00059     hResidualLocalXDT_MB(20),
00060     hResidualLocalPhiDT_MB(20),
00061     hResidualLocalThetaDT_MB(20),
00062     hResidualLocalYDT_MB(20),
00063     hResidualGlobalRPhiDT_W(5),
00064     hResidualGlobalPhiDT_W(5),
00065     hResidualGlobalThetaDT_W(5),
00066     hResidualGlobalZDT_W(5),    
00067     hResidualGlobalRPhiCSC_ME(18),
00068     hResidualGlobalPhiCSC_ME(18),
00069     hResidualGlobalThetaCSC_ME(18),
00070     hResidualGlobalRCSC_ME(18),
00071     hResidualGlobalRPhiDT_MB(20),
00072     hResidualGlobalPhiDT_MB(20),
00073     hResidualGlobalThetaDT_MB(20),
00074     hResidualGlobalZDT_MB(20)
00075 
00076 
00077 {
00078     theSTAMuonTag = pset.getParameter<edm::InputTag>("StandAloneTrackCollectionTag");
00079     theGLBMuonTag = pset.getParameter<edm::InputTag>("GlobalMuonTrackCollectionTag");
00080 
00081     theRecHits4DTagDT = pset.getParameter<edm::InputTag>("RecHits4DDTCollectionTag");
00082     theRecHits4DTagCSC = pset.getParameter<edm::InputTag>("RecHits4DCSCCollectionTag");
00083   
00084     theDataType = pset.getUntrackedParameter<std::string>("DataType");
00085     ptRangeMin = pset.getUntrackedParameter<double>("ptRangeMin");
00086     ptRangeMax = pset.getUntrackedParameter<double>("ptRangeMax");
00087     invMassRangeMin = pset.getUntrackedParameter<double>("invMassRangeMin");
00088     invMassRangeMax = pset.getUntrackedParameter<double>("invMassRangeMax");
00089 
00090     doSAplots = pset.getUntrackedParameter<bool>("doSAplots");
00091     doGBplots = pset.getUntrackedParameter<bool>("doGBplots");
00092     doResplots = pset.getUntrackedParameter<bool>("doResplots");
00093 
00094     resLocalXRangeStation1 = pset.getUntrackedParameter<double>("resLocalXRangeStation1");
00095     resLocalXRangeStation2 = pset.getUntrackedParameter<double>("resLocalXRangeStation2");
00096     resLocalXRangeStation3 = pset.getUntrackedParameter<double>("resLocalXRangeStation3");
00097     resLocalXRangeStation4 = pset.getUntrackedParameter<double>("resLocalXRangeStation4");
00098     resLocalYRangeStation1 = pset.getUntrackedParameter<double>("resLocalYRangeStation1");
00099     resLocalYRangeStation2 = pset.getUntrackedParameter<double>("resLocalYRangeStation2");
00100     resLocalYRangeStation3 = pset.getUntrackedParameter<double>("resLocalYRangeStation3");
00101     resLocalYRangeStation4 = pset.getUntrackedParameter<double>("resLocalYRangeStation4");
00102     resPhiRange = pset.getUntrackedParameter<double>("resPhiRange");
00103     resThetaRange = pset.getUntrackedParameter<double>("resThetaRange");
00104     nbins = pset.getUntrackedParameter<unsigned int>("nbins");
00105     min1DTrackRecHitSize = pset.getUntrackedParameter<unsigned int>("min1DTrackRecHitSize");
00106     min4DTrackSegmentSize = pset.getUntrackedParameter<unsigned int>("min4DTrackSegmentSize");
00107   
00108     if(theDataType != "RealData" && theDataType != "SimData")
00109         edm::LogError("MuonAlignmentAnalyzer")  << "Error in Data Type!!"<<std::endl;
00110 
00111     numberOfSimTracks=0;
00112     numberOfSARecTracks=0;
00113     numberOfGBRecTracks=0;
00114     numberOfHits=0;
00115 }
00116 
00118 MuonAlignmentAnalyzer::~MuonAlignmentAnalyzer(){
00119 }
00120 
00121 void MuonAlignmentAnalyzer::beginJob(){
00122 
00123 //  eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
00124   
00125     //Create the propagator
00126 //  if(doResplots)  thePropagator = new SteppingHelixPropagator(&*theMGField, alongMomentum);
00127 
00128     int nBinsPt= (int) fabs(ptRangeMax-ptRangeMin);
00129     int nBinsMass= (int) fabs(invMassRangeMax-invMassRangeMin);
00130 
00131 // Define and book histograms for SA and GB muon quantities/objects
00132 
00133     if(doGBplots) {
00134         hGBNmuons = fs->make<TH1F>("GBNmuons","Nmuons",10,0,10);
00135         hGBNmuons_Barrel = fs->make<TH1F>("GBNmuons_Barrel","Nmuons",10,0,10);
00136         hGBNmuons_Endcap = fs->make<TH1F>("GBNmuons_Endcap","Nmuons",10,0,10);
00137         hGBNhits = fs->make<TH1F>("GBNhits","Nhits",100,0,100);
00138         hGBNhits_Barrel = fs->make<TH1F>("GBNhits_Barrel","Nhits",100,0,100);
00139         hGBNhits_Endcap = fs->make<TH1F>("GBNhits_Endcap","Nhits",100,0,100);
00140         hGBPTRec = fs->make<TH1F>("GBpTRec","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
00141         hGBPTRec_Barrel = fs->make<TH1F>("GBpTRec_Barrel","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
00142         hGBPTRec_Endcap = fs->make<TH1F>("GBpTRec_Endcap","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
00143         hGBPTvsEta = fs->make<TH2F> ("GBPTvsEta","p_{T}^{rec} VS #eta",100,-2.5,2.5,nBinsPt,ptRangeMin,ptRangeMax);
00144         hGBPTvsPhi = fs->make<TH2F> ("GBPTvsPhi","p_{T}^{rec} VS #phi",100,-3.1416,3.1416,nBinsPt,ptRangeMin,ptRangeMax);
00145         hGBPhivsEta = fs->make<TH2F> ("GBPhivsEta","#phi VS #eta",100,-2.5,2.5,100,-3.1416,3.1416);
00146 
00147         if(theDataType == "SimData"){
00148             hGBPTDiff = fs->make<TH1F>("GBpTDiff","p_{T}^{rec} - p_{T}^{gen} ",250,-120,120);
00149             hGBPTDiffvsEta = fs->make<TH2F> ("GBPTDiffvsEta","p_{T}^{rec} - p_{T}^{gen} VS #eta",100,-2.5,2.5,250,-120,120);
00150             hGBPTDiffvsPhi = fs->make<TH2F> ("GBPTDiffvsPhi","p_{T}^{rec} - p_{T}^{gen} VS #phi",100,-3.1416,3.1416,250,-120,120);
00151             hGBPTres = fs->make<TH1F>("GBpTRes","pT Resolution",100,-2,2);
00152             hGBPTres_Barrel = fs->make<TH1F>("GBpTRes_Barrel","pT Resolution",100,-2,2);
00153             hGBPTres_Endcap = fs->make<TH1F>("GBpTRes_Endcap","pT Resolution",100,-2,2);
00154             hGBinvPTres = fs->make<TH1F>("GBinvPTRes","#sigma (q/p_{T}) Resolution",100,-2,2);  
00155             hGBinvPTvsEta = fs->make<TH2F> ("GBinvPTvsEta","#sigma (q/p_{T}) VS #eta",100,-2.5,2.5,100,-2,2);
00156             hGBinvPTvsPhi = fs->make<TH2F> ("GBinvPTvsPhi","#sigma (q/p_{T}) VS #phi",100,-3.1416,3.1416,100,-2,2);
00157             hGBinvPTvsNhits = fs->make<TH2F> ("GBinvPTvsNhits","#sigma (q/p_{T}) VS Nhits",100,0,100,100,-2,2);
00158         }
00159   
00160         hGBChi2 = fs->make<TH1F>("GBChi2","Chi2",200,0,200);
00161         hGBChi2_Barrel = fs->make<TH1F>("GBChi2_Barrel","Chi2",200,0,200);
00162         hGBChi2_Endcap  = fs->make<TH1F>("GBChi2_Endcap ","Chi2",200,0,200);
00163         hGBInvM = fs->make<TH1F>("GBInvM","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00164         hGBInvM_Barrel = fs->make<TH1F>("GBInvM_Barrel","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00165         hGBInvM_Endcap  = fs->make<TH1F>("GBInvM_Endcap ","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00166         hGBInvM_Overlap = fs->make<TH1F>("GBInvM_Overlap","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00167     }
00168   
00169   
00170     if(doSAplots) {
00171         hSANmuons = fs->make<TH1F>("SANmuons","Nmuons",10,0,10);
00172         hSANmuons_Barrel = fs->make<TH1F>("SANmuons_Barrel","Nmuons",10,0,10);
00173         hSANmuons_Endcap = fs->make<TH1F>("SANmuons_Endcap","Nmuons",10,0,10);
00174         hSANhits = fs->make<TH1F>("SANhits","Nhits",100,0,100);
00175         hSANhits_Barrel = fs->make<TH1F>("SANhits_Barrel","Nhits",100,0,100);
00176         hSANhits_Endcap = fs->make<TH1F>("SANhits_Endcap","Nhits",100,0,100);
00177         hSAPTRec = fs->make<TH1F>("SApTRec","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
00178         hSAPTRec_Barrel = fs->make<TH1F>("SApTRec_Barrel","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
00179         hSAPTRec_Endcap = fs->make<TH1F>("SApTRec_Endcap","p_{T}^{rec}",nBinsPt,ptRangeMin,ptRangeMax);
00180         hSAPTvsEta = fs->make<TH2F> ("SAPTvsEta","p_{T}^{rec} VS #eta",100,-2.5,2.5,nBinsPt,ptRangeMin,ptRangeMax);
00181         hSAPTvsPhi = fs->make<TH2F> ("SAPTvsPhi","p_{T}^{rec} VS #phi",100,-3.1416,3.1416,nBinsPt,ptRangeMin,ptRangeMax);
00182         hSAPhivsEta = fs->make<TH2F> ("SAPhivsEta","#phi VS #eta",100,-2.5,2.5,100,-3.1416,3.1416);
00183 
00184         if(theDataType == "SimData"){
00185             hSAPTDiff = fs->make<TH1F>("SApTDiff","p_{T}^{rec} - p_{T}^{gen} ",250,-120,120);
00186             hSAPTDiffvsEta = fs->make<TH2F> ("SAPTDiffvsEta","p_{T}^{rec} - p_{T}^{gen} VS #eta",100,-2.5,2.5,250,-120,120);
00187             hSAPTDiffvsPhi = fs->make<TH2F> ("SAPTDiffvsPhi","p_{T}^{rec} - p_{T}^{gen} VS #phi",100,-3.1416,3.1416,250,-120,120);
00188             hSAPTres = fs->make<TH1F>("SApTRes","pT Resolution",100,-2,2);
00189             hSAPTres_Barrel = fs->make<TH1F>("SApTRes_Barrel","pT Resolution",100,-2,2);
00190             hSAPTres_Endcap = fs->make<TH1F>("SApTRes_Endcap","pT Resolution",100,-2,2);
00191             hSAinvPTres = fs->make<TH1F>("SAinvPTRes","1/pT Resolution",100,-2,2);
00192 
00193             hSAinvPTvsEta = fs->make<TH2F> ("SAinvPTvsEta","#sigma (q/p_{T}) VS #eta",100,-2.5,2.5,100,-2,2);
00194             hSAinvPTvsPhi = fs->make<TH2F> ("SAinvPTvsPhi","#sigma (q/p_{T}) VS #phi",100,-3.1416,3.1416,100,-2,2);
00195             hSAinvPTvsNhits = fs->make<TH2F> ("SAinvPTvsNhits","#sigma (q/p_{T}) VS Nhits",100,0,100,100,-2,2);
00196         }
00197         hSAInvM = fs->make<TH1F>("SAInvM","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00198         hSAInvM_Barrel = fs->make<TH1F>("SAInvM_Barrel","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00199         hSAInvM_Endcap = fs->make<TH1F>("SAInvM_Endcap","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00200         hSAInvM_Overlap = fs->make<TH1F>("SAInvM_Overlap","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00201         hSAChi2 = fs->make<TH1F>("SAChi2","Chi2",200,0,200);
00202         hSAChi2_Barrel = fs->make<TH1F>("SAChi2_Barrel","Chi2",200,0,200);
00203         hSAChi2_Endcap = fs->make<TH1F>("SAChi2_Endcap","Chi2",200,0,200);
00204     }
00205 
00206 
00207     if(theDataType == "SimData"){
00208         hSimNmuons = fs->make<TH1F>("SimNmuons","Nmuons",10,0,10);
00209         hSimNmuons_Barrel = fs->make<TH1F>("SimNmuons_Barrel","Nmuons",10,0,10);
00210         hSimNmuons_Endcap = fs->make<TH1F>("SimNmuons_Endcap","Nmuons",10,0,10);
00211         hSimPT = fs->make<TH1F>("SimPT","p_{T}^{gen} ",nBinsPt,ptRangeMin,ptRangeMax);
00212         hSimPT_Barrel = fs->make<TH1F>("SimPT_Barrel","p_{T}^{gen} ",nBinsPt,ptRangeMin,ptRangeMax);
00213         hSimPT_Endcap = fs->make<TH1F>("SimPT_Endcap","p_{T}^{gen} ",nBinsPt,ptRangeMin,ptRangeMax);
00214         hSimPTvsEta = fs->make<TH2F> ("SimPTvsEta","p_{T}^{gen} VS #eta",100,-2.5,2.5,nBinsPt,ptRangeMin,ptRangeMax);
00215         hSimPTvsPhi = fs->make<TH2F> ("SimPTvsPhi","p_{T}^{gen} VS #phi",100,-3.1416,3.1416,nBinsPt,ptRangeMin,ptRangeMax);
00216         hSimPhivsEta = fs->make<TH2F> ("SimPhivsEta","#phi VS #eta",100,-2.5,2.5,100,-3.1416,3.1416);
00217         hSimInvM = fs->make<TH1F>("SimInvM","M_{inv}^{gen} ",nBinsMass,invMassRangeMin,invMassRangeMax);
00218         hSimInvM_Barrel = fs->make<TH1F>("SimInvM_Barrel","M_{inv}^{rec}",nBinsMass,invMassRangeMin,invMassRangeMax);
00219         hSimInvM_Endcap = fs->make<TH1F>("SimInvM_Endcap","M_{inv}^{gen} ",nBinsMass,invMassRangeMin,invMassRangeMax);
00220         hSimInvM_Overlap = fs->make<TH1F>("SimInvM_Overlap","M_{inv}^{gen} ",nBinsMass,invMassRangeMin,invMassRangeMax);
00221     }
00222 
00223     if(doResplots){
00224 // All DT and CSC chambers 
00225         hResidualLocalXDT = fs->make<TH1F>("hResidualLocalXDT","hResidualLocalXDT",200,-10,10);
00226         hResidualLocalPhiDT = fs->make<TH1F>("hResidualLocalPhiDT","hResidualLocalPhiDT",100,-1,1);
00227         hResidualLocalThetaDT = fs->make<TH1F>("hResidualLocalThetaDT","hResidualLocalThetaDT",100,-1,1);
00228         hResidualLocalYDT = fs->make<TH1F>("hResidualLocalYDT","hResidualLocalYDT",200,-10,10);
00229         hResidualLocalXCSC = fs->make<TH1F>("hResidualLocalXCSC","hResidualLocalXCSC",200,-10,10);
00230         hResidualLocalPhiCSC = fs->make<TH1F>("hResidualLocalPhiCSC","hResidualLocalPhiCSC",100,-1,1);
00231         hResidualLocalThetaCSC = fs->make<TH1F>("hResidualLocalThetaCSC","hResidualLocalThetaCSC",100,-1,1);
00232         hResidualLocalYCSC = fs->make<TH1F>("hResidualLocalYCSC","hResidualLocalYCSC",200,-10,10);
00233         hResidualGlobalRPhiDT = fs->make<TH1F>("hResidualGlobalRPhiDT","hResidualGlobalRPhiDT",200,-10,10);
00234         hResidualGlobalPhiDT = fs->make<TH1F>("hResidualGlobalPhiDT","hResidualGlobalPhiDT",100,-1,1);
00235         hResidualGlobalThetaDT = fs->make<TH1F>("hResidualGlobalThetaDT","hResidualGlobalThetaDT",100,-1,1);
00236         hResidualGlobalZDT = fs->make<TH1F>("hResidualGlobalZDT","hResidualGlobalZDT",200,-10,10);
00237         hResidualGlobalRPhiCSC = fs->make<TH1F>("hResidualGlobalRPhiCSC","hResidualGlobalRPhiCSC",200,-10,10);
00238         hResidualGlobalPhiCSC = fs->make<TH1F>("hResidualGlobalPhiCSC","hResidualGlobalPhiCSC",100,-1,1);
00239         hResidualGlobalThetaCSC = fs->make<TH1F>("hResidualGlobalThetaCSC","hResidualGlobalThetaCSC",100,-1,1);
00240         hResidualGlobalRCSC = fs->make<TH1F>("hResidualGlobalRCSC","hResidualGlobalRCSC",200,-10,10);
00241 
00242 // DT Wheels
00243         hResidualLocalXDT_W[0]=fs->make<TH1F>("hResidualLocalXDT_W-2","hResidualLocalXDT_W-2",200,-10,10);
00244         hResidualLocalPhiDT_W[0]=fs->make<TH1F>("hResidualLocalPhiDT_W-2","hResidualLocalPhiDT_W-2",200,-1,1);
00245         hResidualLocalThetaDT_W[0]=fs->make<TH1F>("hResidualLocalThetaDT_W-2","hResidualLocalThetaDT_W-2",200,-1,1);
00246         hResidualLocalYDT_W[0] = fs->make<TH1F>("hResidualLocalYDT_W-2","hResidualLocalYDT_W-2",200,-10,10);
00247         hResidualLocalXDT_W[1]=fs->make<TH1F>("hResidualLocalXDT_W-1","hResidualLocalXDT_W-1",200,-10,10);
00248         hResidualLocalPhiDT_W[1]=fs->make<TH1F>("hResidualLocalPhiDT_W-1","hResidualLocalPhiDT_W-1",200,-1,1);
00249         hResidualLocalThetaDT_W[1]=fs->make<TH1F>("hResidualLocalThetaDT_W-1","hResidualLocalThetaDT_W-1",200,-1,1);
00250         hResidualLocalYDT_W[1] = fs->make<TH1F>("hResidualLocalYDT_W-1","hResidualLocalYDT_W-1",200,-10,10);
00251         hResidualLocalXDT_W[2]=fs->make<TH1F>("hResidualLocalXDT_W0","hResidualLocalXDT_W0",200,-10,10);
00252         hResidualLocalPhiDT_W[2]=fs->make<TH1F>("hResidualLocalPhiDT_W0","hResidualLocalPhiDT_W0",200,-1,1);
00253         hResidualLocalThetaDT_W[2]=fs->make<TH1F>("hResidualLocalThetaDT_W0","hResidualLocalThetaDT_W0",200,-1,1);
00254         hResidualLocalYDT_W[2] = fs->make<TH1F>("hResidualLocalYDT_W0","hResidualLocalYDT_W0",200,-10,10);
00255         hResidualLocalXDT_W[3]=fs->make<TH1F>("hResidualLocalXDT_W1","hResidualLocalXDT_W1",200,-10,10);
00256         hResidualLocalPhiDT_W[3]=fs->make<TH1F>("hResidualLocalPhiDT_W1","hResidualLocalPhiDT_W1",200,-1,1);
00257         hResidualLocalThetaDT_W[3]=fs->make<TH1F>("hResidualLocalThetaDT_W1","hResidualLocalThetaDT_W1",200,-1,1);
00258         hResidualLocalYDT_W[3] = fs->make<TH1F>("hResidualLocalYDT_W1","hResidualLocalYDT_W1",200,-10,10);
00259         hResidualLocalXDT_W[4]=fs->make<TH1F>("hResidualLocalXDT_W2","hResidualLocalXDT_W2",200,-10,10);
00260         hResidualLocalPhiDT_W[4]=fs->make<TH1F>("hResidualLocalPhiDT_W2","hResidualLocalPhiDT_W2",200,-1,1);
00261         hResidualLocalThetaDT_W[4]=fs->make<TH1F>("hResidualLocalThetaDT_W2","hResidualLocalThetaDT_W2",200,-1,1);
00262         hResidualLocalYDT_W[4] = fs->make<TH1F>("hResidualLocalYDT_W2","hResidualLocalYDT_W2",200,-10,10);
00263         hResidualGlobalRPhiDT_W[0]=fs->make<TH1F>("hResidualGlobalRPhiDT_W-2","hResidualGlobalRPhiDT_W-2",200,-10,10);
00264         hResidualGlobalPhiDT_W[0]=fs->make<TH1F>("hResidualGlobalPhiDT_W-2","hResidualGlobalPhiDT_W-2",200,-1,1);
00265         hResidualGlobalThetaDT_W[0]=fs->make<TH1F>("hResidualGlobalThetaDT_W-2","hResidualGlobalThetaDT_W-2",200,-1,1);
00266         hResidualGlobalZDT_W[0] = fs->make<TH1F>("hResidualGlobalZDT_W-2","hResidualGlobalZDT_W-2",200,-10,10);
00267         hResidualGlobalRPhiDT_W[1]=fs->make<TH1F>("hResidualGlobalRPhiDT_W-1","hResidualGlobalRPhiDT_W-1",200,-10,10);
00268         hResidualGlobalPhiDT_W[1]=fs->make<TH1F>("hResidualGlobalPhiDT_W-1","hResidualGlobalPhiDT_W-1",200,-1,1);
00269         hResidualGlobalThetaDT_W[1]=fs->make<TH1F>("hResidualGlobalThetaDT_W-1","hResidualGlobalThetaDT_W-1",200,-1,1);
00270         hResidualGlobalZDT_W[1] = fs->make<TH1F>("hResidualGlobalZDT_W-1","hResidualGlobalZDT_W-1",200,-10,10);
00271         hResidualGlobalRPhiDT_W[2]=fs->make<TH1F>("hResidualGlobalRPhiDT_W0","hResidualGlobalRPhiDT_W0",200,-10,10);
00272         hResidualGlobalPhiDT_W[2]=fs->make<TH1F>("hResidualGlobalPhiDT_W0","hResidualGlobalPhiDT_W0",200,-1,1);
00273         hResidualGlobalThetaDT_W[2]=fs->make<TH1F>("hResidualGlobalThetaDT_W0","hResidualGlobalThetaDT_W0",200,-1,1);
00274         hResidualGlobalZDT_W[2] = fs->make<TH1F>("hResidualGlobalZDT_W0","hResidualGlobalZDT_W0",200,-10,10);
00275         hResidualGlobalRPhiDT_W[3]=fs->make<TH1F>("hResidualGlobalRPhiDT_W1","hResidualGlobalRPhiDT_W1",200,-10,10);
00276         hResidualGlobalPhiDT_W[3]=fs->make<TH1F>("hResidualGlobalPhiDT_W1","hResidualGlobalPhiDT_W1",200,-1,1);
00277         hResidualGlobalThetaDT_W[3]=fs->make<TH1F>("hResidualGlobalThetaDT_W1","hResidualGlobalThetaDT_W1",200,-1,1);
00278         hResidualGlobalZDT_W[3] = fs->make<TH1F>("hResidualGlobalZDT_W1","hResidualGlobalZDT_W1",200,-10,10);
00279         hResidualGlobalRPhiDT_W[4]=fs->make<TH1F>("hResidualGlobalRPhiDT_W2","hResidualGlobalRPhiDT_W2",200,-10,10);
00280         hResidualGlobalPhiDT_W[4]=fs->make<TH1F>("hResidualGlobalPhiDT_W2","hResidualGlobalPhiDT_W2",200,-1,1);
00281         hResidualGlobalThetaDT_W[4]=fs->make<TH1F>("hResidualGlobalThetaDT_W2","hResidualGlobalThetaDT_W2",200,-1,1);
00282         hResidualGlobalZDT_W[4] = fs->make<TH1F>("hResidualGlobalZDT_W2","hResidualGlobalZDT_W2",200,-10,10);
00283 
00284 // DT Stations
00285         hResidualLocalXDT_MB[0]=fs->make<TH1F>("hResidualLocalXDT_MB-2/1","hResidualLocalXDT_MB-2/1",200,-10,10);
00286         hResidualLocalPhiDT_MB[0]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/1","hResidualLocalPhiDT_MB-2/1",200,-1,1);
00287         hResidualLocalThetaDT_MB[0]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/1","hResidualLocalThetaDT_MB-2/1",200,-1,1);
00288         hResidualLocalYDT_MB[0] = fs->make<TH1F>("hResidualLocalYDT_MB-2/1","hResidualLocalYDT_MB-2/1",200,-10,10);
00289         hResidualLocalXDT_MB[1]=fs->make<TH1F>("hResidualLocalXDT_MB-2/2","hResidualLocalXDT_MB-2/2",200,-10,10);
00290         hResidualLocalPhiDT_MB[1]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/2","hResidualLocalPhiDT_MB-2/2",200,-1,1);
00291         hResidualLocalThetaDT_MB[1]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/2","hResidualLocalThetaDT_MB-2/2",200,-1,1);
00292         hResidualLocalYDT_MB[1] = fs->make<TH1F>("hResidualLocalYDT_MB-2/2","hResidualLocalYDT_MB-2/2",200,-10,10);
00293         hResidualLocalXDT_MB[2]=fs->make<TH1F>("hResidualLocalXDT_MB-2/3","hResidualLocalXDT_MB-2/3",200,-10,10);
00294         hResidualLocalPhiDT_MB[2]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/3","hResidualLocalPhiDT_MB-2/3",200,-1,1);
00295         hResidualLocalThetaDT_MB[2]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/3","hResidualLocalThetaDT_MB-2/3",200,-1,1);
00296         hResidualLocalYDT_MB[2] = fs->make<TH1F>("hResidualLocalYDT_MB-2/3","hResidualLocalYDT_MB-2/3",200,-10,10);
00297         hResidualLocalXDT_MB[3]=fs->make<TH1F>("hResidualLocalXDT_MB-2/4","hResidualLocalXDT_MB-2/4",200,-10,10);
00298         hResidualLocalPhiDT_MB[3]=fs->make<TH1F>("hResidualLocalPhiDT_MB-2/4","hResidualLocalPhiDT_MB-2/4",200,-1,1);
00299         hResidualLocalThetaDT_MB[3]=fs->make<TH1F>("hResidualLocalThetaDT_MB-2/4","hResidualLocalThetaDT_MB-2/4",200,-1,1);
00300         hResidualLocalYDT_MB[3] = fs->make<TH1F>("hResidualLocalYDT_MB-2/4","hResidualLocalYDT_MB-2/4",200,-10,10);
00301         hResidualLocalXDT_MB[4]=fs->make<TH1F>("hResidualLocalXDT_MB-1/1","hResidualLocalXDT_MB-1/1",200,-10,10);
00302         hResidualLocalPhiDT_MB[4]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/1","hResidualLocalPhiDT_MB-1/1",200,-1,1);
00303         hResidualLocalThetaDT_MB[4]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/1","hResidualLocalThetaDT_MB-1/1",200,-1,1);
00304         hResidualLocalYDT_MB[4] = fs->make<TH1F>("hResidualLocalYDT_MB-1/1","hResidualLocalYDT_MB-1/1",200,-10,10);
00305         hResidualLocalXDT_MB[5]=fs->make<TH1F>("hResidualLocalXDT_MB-1/2","hResidualLocalXDT_MB-1/2",200,-10,10);
00306         hResidualLocalPhiDT_MB[5]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/2","hResidualLocalPhiDT_MB-1/2",200,-1,1);
00307         hResidualLocalThetaDT_MB[5]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/2","hResidualLocalThetaDT_MB-1/2",200,-1,1);
00308         hResidualLocalYDT_MB[5] = fs->make<TH1F>("hResidualLocalYDT_MB-1/2","hResidualLocalYDT_MB-1/2",200,-10,10);
00309         hResidualLocalXDT_MB[6]=fs->make<TH1F>("hResidualLocalXDT_MB-1/3","hResidualLocalXDT_MB-1/3",200,-10,10);
00310         hResidualLocalPhiDT_MB[6]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/3","hResidualLocalPhiDT_MB-1/3",200,-1,1);
00311         hResidualLocalThetaDT_MB[6]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/3","hResidualLocalThetaDT_MB-1/3",200,-1,1);
00312         hResidualLocalYDT_MB[6] = fs->make<TH1F>("hResidualLocalYDT_MB-1/3","hResidualLocalYDT_MB-1/3",200,-10,10);
00313         hResidualLocalXDT_MB[7]=fs->make<TH1F>("hResidualLocalXDT_MB-1/4","hResidualLocalXDT_MB-1/4",200,-10,10);
00314         hResidualLocalPhiDT_MB[7]=fs->make<TH1F>("hResidualLocalPhiDT_MB-1/4","hResidualLocalPhiDT_MB-1/4",200,-1,1);
00315         hResidualLocalThetaDT_MB[7]=fs->make<TH1F>("hResidualLocalThetaDT_MB-1/4","hResidualLocalThetaDT_MB-1/4",200,-1,1);
00316         hResidualLocalYDT_MB[7] = fs->make<TH1F>("hResidualLocalYDT_MB-1/4","hResidualLocalYDT_MB-1/4",200,-10,10);
00317         hResidualLocalXDT_MB[8]=fs->make<TH1F>("hResidualLocalXDT_MB0/1","hResidualLocalXDT_MB0/1",200,-10,10);
00318         hResidualLocalPhiDT_MB[8]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/1","hResidualLocalPhiDT_MB0/1",200,-1,1);
00319         hResidualLocalThetaDT_MB[8]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/1","hResidualLocalThetaDT_MB0/1",200,-1,1);
00320         hResidualLocalYDT_MB[8] = fs->make<TH1F>("hResidualLocalYDT_MB0/1","hResidualLocalYDT_MB0/1",200,-10,10);
00321         hResidualLocalXDT_MB[9]=fs->make<TH1F>("hResidualLocalXDT_MB0/2","hResidualLocalXDT_MB0/2",200,-10,10);
00322         hResidualLocalPhiDT_MB[9]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/2","hResidualLocalPhiDT_MB0/2",200,-1,1);
00323         hResidualLocalThetaDT_MB[9]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/2","hResidualLocalThetaDT_MB0/2",200,-1,1);
00324         hResidualLocalYDT_MB[9] = fs->make<TH1F>("hResidualLocalYDT_MB0/2","hResidualLocalYDT_MB0/2",200,-10,10);
00325         hResidualLocalXDT_MB[10]=fs->make<TH1F>("hResidualLocalXDT_MB0/3","hResidualLocalXDT_MB0/3",200,-10,10);
00326         hResidualLocalThetaDT_MB[10]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/3","hResidualLocalThetaDT_MB0/3",200,-1,1);
00327         hResidualLocalPhiDT_MB[10]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/3","hResidualLocalPhiDT_MB0/3",200,-1,1);
00328         hResidualLocalYDT_MB[10] = fs->make<TH1F>("hResidualLocalYDT_MB0/3","hResidualLocalYDT_MB0/3",200,-10,10);
00329         hResidualLocalXDT_MB[11]=fs->make<TH1F>("hResidualLocalXDT_MB0/4","hResidualLocalXDT_MB0/4",200,-10,10);
00330         hResidualLocalPhiDT_MB[11]=fs->make<TH1F>("hResidualLocalPhiDT_MB0/4","hResidualLocalPhiDT_MB0/4",200,-1,1);
00331         hResidualLocalThetaDT_MB[11]=fs->make<TH1F>("hResidualLocalThetaDT_MB0/4","hResidualLocalThetaDT_MB0/4",200,-1,1);
00332         hResidualLocalYDT_MB[11] = fs->make<TH1F>("hResidualLocalYDT_MB0/4","hResidualLocalYDT_MB0/4",200,-10,10);
00333         hResidualLocalXDT_MB[12]=fs->make<TH1F>("hResidualLocalXDT_MB1/1","hResidualLocalXDT_MB1/1",200,-10,10);
00334         hResidualLocalPhiDT_MB[12]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/1","hResidualLocalPhiDT_MB1/1",200,-1,1);
00335         hResidualLocalThetaDT_MB[12]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/1","hResidualLocalThetaDT_MB1/1",200,-1,1);
00336         hResidualLocalYDT_MB[12] = fs->make<TH1F>("hResidualLocalYDT_MB1/1","hResidualLocalYDT_MB1/1",200,-10,10);
00337         hResidualLocalXDT_MB[13]=fs->make<TH1F>("hResidualLocalXDT_MB1/2","hResidualLocalXDT_MB1/2",200,-10,10);
00338         hResidualLocalPhiDT_MB[13]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/2","hResidualLocalPhiDT_MB1/2",200,-1,1);
00339         hResidualLocalThetaDT_MB[13]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/2","hResidualLocalThetaDT_MB1/2",200,-1,1);
00340         hResidualLocalYDT_MB[13] = fs->make<TH1F>("hResidualLocalYDT_MB1/2","hResidualLocalYDT_MB1/2",200,-10,10);
00341         hResidualLocalXDT_MB[14]=fs->make<TH1F>("hResidualLocalXDT_MB1/3","hResidualLocalXDT_MB1/3",200,-10,10);
00342         hResidualLocalPhiDT_MB[14]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/3","hResidualLocalPhiDT_MB1/3",200,-1,1);
00343         hResidualLocalThetaDT_MB[14]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/3","hResidualLocalThetaDT_MB1/3",200,-1,1);
00344         hResidualLocalYDT_MB[14] = fs->make<TH1F>("hResidualLocalYDT_MB1/3","hResidualLocalYDT_MB1/3",200,-10,10);
00345         hResidualLocalXDT_MB[15]=fs->make<TH1F>("hResidualLocalXDT_MB1/4","hResidualLocalXDT_MB1/4",200,-10,10);
00346         hResidualLocalPhiDT_MB[15]=fs->make<TH1F>("hResidualLocalPhiDT_MB1/4","hResidualLocalPhiDT_MB1/4",200,-1,1);
00347         hResidualLocalThetaDT_MB[15]=fs->make<TH1F>("hResidualLocalThetaDT_MB1/4","hResidualLocalThetaDT_MB1/4",200,-1,1);
00348         hResidualLocalYDT_MB[15] = fs->make<TH1F>("hResidualLocalYDT_MB1/4","hResidualLocalYDT_MB1/4",200,-10,10);
00349         hResidualLocalXDT_MB[16]=fs->make<TH1F>("hResidualLocalXDT_MB2/1","hResidualLocalXDT_MB2/1",200,-10,10);
00350         hResidualLocalPhiDT_MB[16]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/1","hResidualLocalPhiDT_MB2/1",200,-1,1);
00351         hResidualLocalThetaDT_MB[16]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/1","hResidualLocalThetaDT_MB2/1",200,-1,1);
00352         hResidualLocalYDT_MB[16] = fs->make<TH1F>("hResidualLocalYDT_MB2/1","hResidualLocalYDT_MB2/1",200,-10,10);
00353         hResidualLocalXDT_MB[17]=fs->make<TH1F>("hResidualLocalXDT_MB2/2","hResidualLocalXDT_MB2/2",200,-10,10);
00354         hResidualLocalPhiDT_MB[17]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/2","hResidualLocalPhiDT_MB2/2",200,-1,1);
00355         hResidualLocalThetaDT_MB[17]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/2","hResidualLocalThetaDT_MB2/2",200,-1,1);
00356         hResidualLocalYDT_MB[17] = fs->make<TH1F>("hResidualLocalYDT_MB2/2","hResidualLocalYDT_MB2/2",200,-10,10);
00357         hResidualLocalXDT_MB[18]=fs->make<TH1F>("hResidualLocalXDT_MB2/3","hResidualLocalXDT_MB2/3",200,-10,10);
00358         hResidualLocalPhiDT_MB[18]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/3","hResidualLocalPhiDT_MB2/3",200,-1,1);
00359         hResidualLocalThetaDT_MB[18]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/3","hResidualLocalThetaDT_MB2/3",200,-1,1);
00360         hResidualLocalYDT_MB[18] = fs->make<TH1F>("hResidualLocalYDT_MB2/3","hResidualLocalYDT_MB2/3",200,-10,10);
00361         hResidualLocalXDT_MB[19]=fs->make<TH1F>("hResidualLocalXDT_MB2/4","hResidualLocalXDT_MB2/4",200,-10,10);
00362         hResidualLocalPhiDT_MB[19]=fs->make<TH1F>("hResidualLocalPhiDT_MB2/4","hResidualLocalPhiDT_MB2/4",200,-1,1);
00363         hResidualLocalThetaDT_MB[19]=fs->make<TH1F>("hResidualLocalThetaDT_MB2/4","hResidualLocalThetaDT_MB2/4",200,-1,1);
00364         hResidualLocalYDT_MB[19] = fs->make<TH1F>("hResidualLocalYDT_MB2/4","hResidualLocalYDT_MB2/4",200,-10,10);
00365         hResidualGlobalRPhiDT_MB[0]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/1","hResidualGlobalRPhiDT_MB-2/1",200,-10,10);
00366         hResidualGlobalPhiDT_MB[0]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/1","hResidualGlobalPhiDT_MB-2/1",200,-1,1);
00367         hResidualGlobalThetaDT_MB[0]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/1","hResidualGlobalThetaDT_MB-2/1",200,-1,1);
00368         hResidualGlobalZDT_MB[0] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/1","hResidualGlobalZDT_MB-2/1",200,-10,10);
00369         hResidualGlobalRPhiDT_MB[1]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/2","hResidualGlobalRPhiDT_MB-2/2",200,-10,10);
00370         hResidualGlobalPhiDT_MB[1]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/2","hResidualGlobalPhiDT_MB-2/2",200,-1,1);
00371         hResidualGlobalThetaDT_MB[1]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/2","hResidualGlobalThetaDT_MB-2/2",200,-1,1);
00372         hResidualGlobalZDT_MB[1] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/2","hResidualGlobalZDT_MB-2/2",200,-10,10);
00373         hResidualGlobalRPhiDT_MB[2]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/3","hResidualGlobalRPhiDT_MB-2/3",200,-10,10);
00374         hResidualGlobalPhiDT_MB[2]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/3","hResidualGlobalPhiDT_MB-2/3",200,-1,1);
00375         hResidualGlobalThetaDT_MB[2]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/3","hResidualGlobalThetaDT_MB-2/3",200,-1,1);
00376         hResidualGlobalZDT_MB[2] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/3","hResidualGlobalZDT_MB-2/3",200,-10,10);
00377         hResidualGlobalRPhiDT_MB[3]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-2/4","hResidualGlobalRPhiDT_MB-2/4",200,-10,10);
00378         hResidualGlobalPhiDT_MB[3]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-2/4","hResidualGlobalPhiDT_MB-2/4",200,-1,1);
00379         hResidualGlobalThetaDT_MB[3]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-2/4","hResidualGlobalThetaDT_MB-2/4",200,-1,1);
00380         hResidualGlobalZDT_MB[3] = fs->make<TH1F>("hResidualGlobalZDT_MB-2/4","hResidualGlobalZDT_MB-2/4",200,-10,10);
00381         hResidualGlobalRPhiDT_MB[4]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/1","hResidualGlobalRPhiDT_MB-1/1",200,-10,10);
00382         hResidualGlobalPhiDT_MB[4]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/1","hResidualGlobalPhiDT_MB-1/1",200,-1,1);
00383         hResidualGlobalThetaDT_MB[4]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/1","hResidualGlobalThetaDT_MB-1/1",200,-1,1);
00384         hResidualGlobalZDT_MB[4] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/1","hResidualGlobalZDT_MB-1/1",200,-10,10);
00385         hResidualGlobalRPhiDT_MB[5]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/2","hResidualGlobalRPhiDT_MB-1/2",200,-10,10);
00386         hResidualGlobalPhiDT_MB[5]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/2","hResidualGlobalPhiDT_MB-1/2",200,-1,1);
00387         hResidualGlobalThetaDT_MB[5]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/2","hResidualGlobalThetaDT_MB-1/2",200,-1,1);
00388         hResidualGlobalZDT_MB[5] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/2","hResidualGlobalZDT_MB-1/2",200,-10,10);
00389         hResidualGlobalRPhiDT_MB[6]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/3","hResidualGlobalRPhiDT_MB-1/3",200,-10,10);
00390         hResidualGlobalPhiDT_MB[6]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/3","hResidualGlobalPhiDT_MB-1/3",200,-1,1);
00391         hResidualGlobalThetaDT_MB[6]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/3","hResidualGlobalThetaDT_MB-1/3",200,-1,1);
00392         hResidualGlobalZDT_MB[6] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/3","hResidualGlobalZDT_MB-1/3",200,-10,10);
00393         hResidualGlobalRPhiDT_MB[7]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB-1/4","hResidualGlobalRPhiDT_MB-1/4",200,-10,10);
00394         hResidualGlobalPhiDT_MB[7]=fs->make<TH1F>("hResidualGlobalPhiDT_MB-1/4","hResidualGlobalPhiDT_MB-1/4",200,-1,1);
00395         hResidualGlobalThetaDT_MB[7]=fs->make<TH1F>("hResidualGlobalThetaDT_MB-1/4","hResidualGlobalThetaDT_MB-1/4",200,-1,1);
00396         hResidualGlobalZDT_MB[7] = fs->make<TH1F>("hResidualGlobalZDT_MB-1/4","hResidualGlobalZDT_MB-1/4",200,-10,10);
00397         hResidualGlobalRPhiDT_MB[8]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/1","hResidualGlobalRPhiDT_MB0/1",200,-10,10);
00398         hResidualGlobalPhiDT_MB[8]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/1","hResidualGlobalPhiDT_MB0/1",200,-1,1);
00399         hResidualGlobalThetaDT_MB[8]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/1","hResidualGlobalThetaDT_MB0/1",200,-1,1);
00400         hResidualGlobalZDT_MB[8] = fs->make<TH1F>("hResidualGlobalZDT_MB0/1","hResidualGlobalZDT_MB0/1",200,-10,10);
00401         hResidualGlobalRPhiDT_MB[9]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/2","hResidualGlobalRPhiDT_MB0/2",200,-10,10);
00402         hResidualGlobalPhiDT_MB[9]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/2","hResidualGlobalPhiDT_MB0/2",200,-1,1);
00403         hResidualGlobalThetaDT_MB[9]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/2","hResidualGlobalThetaDT_MB0/2",200,-1,1);
00404         hResidualGlobalZDT_MB[9] = fs->make<TH1F>("hResidualGlobalZDT_MB0/2","hResidualGlobalZDT_MB0/2",200,-10,10);
00405         hResidualGlobalRPhiDT_MB[10]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/3","hResidualGlobalRPhiDT_MB0/3",200,-10,10);
00406         hResidualGlobalThetaDT_MB[10]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/3","hResidualGlobalThetaDT_MB0/3",200,-1,1);
00407         hResidualGlobalPhiDT_MB[10]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/3","hResidualGlobalPhiDT_MB0/3",200,-1,1);
00408         hResidualGlobalZDT_MB[10] = fs->make<TH1F>("hResidualGlobalZDT_MB0/3","hResidualGlobalZDT_MB0/3",200,-10,10);
00409         hResidualGlobalRPhiDT_MB[11]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB0/4","hResidualGlobalRPhiDT_MB0/4",200,-10,10);
00410         hResidualGlobalPhiDT_MB[11]=fs->make<TH1F>("hResidualGlobalPhiDT_MB0/4","hResidualGlobalPhiDT_MB0/4",200,-1,1);
00411         hResidualGlobalThetaDT_MB[11]=fs->make<TH1F>("hResidualGlobalThetaDT_MB0/4","hResidualGlobalThetaDT_MB0/4",200,-1,1);
00412         hResidualGlobalZDT_MB[11] = fs->make<TH1F>("hResidualGlobalZDT_MB0/4","hResidualGlobalZDT_MB0/4",200,-10,10);
00413         hResidualGlobalRPhiDT_MB[12]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/1","hResidualGlobalRPhiDT_MB1/1",200,-10,10);
00414         hResidualGlobalPhiDT_MB[12]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/1","hResidualGlobalPhiDT_MB1/1",200,-1,1);
00415         hResidualGlobalThetaDT_MB[12]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/1","hResidualGlobalThetaDT_MB1/1",200,-1,1);
00416         hResidualGlobalZDT_MB[12] = fs->make<TH1F>("hResidualGlobalZDT_MB1/1","hResidualGlobalZDT_MB1/1",200,-10,10);
00417         hResidualGlobalRPhiDT_MB[13]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/2","hResidualGlobalRPhiDT_MB1/2",200,-10,10);
00418         hResidualGlobalPhiDT_MB[13]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/2","hResidualGlobalPhiDT_MB1/2",200,-1,1);
00419         hResidualGlobalThetaDT_MB[13]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/2","hResidualGlobalThetaDT_MB1/2",200,-1,1);
00420         hResidualGlobalZDT_MB[13] = fs->make<TH1F>("hResidualGlobalZDT_MB1/2","hResidualGlobalZDT_MB1/2",200,-10,10);
00421         hResidualGlobalRPhiDT_MB[14]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/3","hResidualGlobalRPhiDT_MB1/3",200,-10,10);
00422         hResidualGlobalPhiDT_MB[14]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/3","hResidualGlobalPhiDT_MB1/3",200,-1,1);
00423         hResidualGlobalThetaDT_MB[14]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/3","hResidualGlobalThetaDT_MB1/3",200,-1,1);
00424         hResidualGlobalZDT_MB[14] = fs->make<TH1F>("hResidualGlobalZDT_MB1/3","hResidualGlobalZDT_MB1/3",200,-10,10);
00425         hResidualGlobalRPhiDT_MB[15]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB1/4","hResidualGlobalRPhiDT_MB1/4",200,-10,10);
00426         hResidualGlobalPhiDT_MB[15]=fs->make<TH1F>("hResidualGlobalPhiDT_MB1/4","hResidualGlobalPhiDT_MB1/4",200,-1,1);
00427         hResidualGlobalThetaDT_MB[15]=fs->make<TH1F>("hResidualGlobalThetaDT_MB1/4","hResidualGlobalThetaDT_MB1/4",200,-1,1);
00428         hResidualGlobalZDT_MB[15] = fs->make<TH1F>("hResidualGlobalZDT_MB1/4","hResidualGlobalZDT_MB1/4",200,-10,10);
00429         hResidualGlobalRPhiDT_MB[16]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/1","hResidualGlobalRPhiDT_MB2/1",200,-10,10);
00430         hResidualGlobalPhiDT_MB[16]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/1","hResidualGlobalPhiDT_MB2/1",200,-1,1);
00431         hResidualGlobalThetaDT_MB[16]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/1","hResidualGlobalThetaDT_MB2/1",200,-1,1);
00432         hResidualGlobalZDT_MB[16] = fs->make<TH1F>("hResidualGlobalZDT_MB2/1","hResidualGlobalZDT_MB2/1",200,-10,10);
00433         hResidualGlobalRPhiDT_MB[17]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/2","hResidualGlobalRPhiDT_MB2/2",200,-10,10);
00434         hResidualGlobalPhiDT_MB[17]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/2","hResidualGlobalPhiDT_MB2/2",200,-1,1);
00435         hResidualGlobalThetaDT_MB[17]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/2","hResidualGlobalThetaDT_MB2/2",200,-1,1);
00436         hResidualGlobalZDT_MB[17] = fs->make<TH1F>("hResidualGlobalZDT_MB2/2","hResidualGlobalZDT_MB2/2",200,-10,10);
00437         hResidualGlobalRPhiDT_MB[18]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/3","hResidualGlobalRPhiDT_MB2/3",200,-10,10);
00438         hResidualGlobalPhiDT_MB[18]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/3","hResidualGlobalPhiDT_MB2/3",200,-1,1);
00439         hResidualGlobalThetaDT_MB[18]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/3","hResidualGlobalThetaDT_MB2/3",200,-1,1);
00440         hResidualGlobalZDT_MB[18] = fs->make<TH1F>("hResidualGlobalZDT_MB2/3","hResidualGlobalZDT_MB2/3",200,-10,10);
00441         hResidualGlobalRPhiDT_MB[19]=fs->make<TH1F>("hResidualGlobalRPhiDT_MB2/4","hResidualGlobalRPhiDT_MB2/4",200,-10,10);
00442         hResidualGlobalPhiDT_MB[19]=fs->make<TH1F>("hResidualGlobalPhiDT_MB2/4","hResidualGlobalPhiDT_MB2/4",200,-1,1);
00443         hResidualGlobalThetaDT_MB[19]=fs->make<TH1F>("hResidualGlobalThetaDT_MB2/4","hResidualGlobalThetaDT_MB2/4",200,-1,1);
00444         hResidualGlobalZDT_MB[19] = fs->make<TH1F>("hResidualGlobalZDT_MB2/4","hResidualGlobalZDT_MB2/4",200,-10,10);
00445 
00446 
00447 // CSC Stations
00448         hResidualLocalXCSC_ME[0]=fs->make<TH1F>("hResidualLocalXCSC_ME-4/1","hResidualLocalXCSC_ME-4/1",200,-10,10);
00449         hResidualLocalPhiCSC_ME[0]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-4/1","hResidualLocalPhiCSC_ME-4/1",200,-1,1);
00450         hResidualLocalThetaCSC_ME[0]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-4/1","hResidualLocalThetaCSC_ME-4/1",200,-1,1);
00451         hResidualLocalYCSC_ME[0] = fs->make<TH1F>("hResidualLocalYCSC_ME-4/1","hResidualLocalYCSC_ME-4/1",200,-10,10);
00452         hResidualLocalXCSC_ME[1]=fs->make<TH1F>("hResidualLocalXCSC_ME-4/2","hResidualLocalXCSC_ME-4/2",200,-10,10);
00453         hResidualLocalPhiCSC_ME[1]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-4/2","hResidualLocalPhiCSC_ME-4/2",200,-1,1);
00454         hResidualLocalThetaCSC_ME[1]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-4/2","hResidualLocalThetaCSC_ME-4/2",200,-1,1);
00455         hResidualLocalYCSC_ME[1] = fs->make<TH1F>("hResidualLocalYCSC_ME-4/2","hResidualLocalYCSC_ME-4/2",200,-10,10);
00456         hResidualLocalXCSC_ME[2]=fs->make<TH1F>("hResidualLocalXCSC_ME-3/1","hResidualLocalXCSC_ME-3/1",200,-10,10);
00457         hResidualLocalPhiCSC_ME[2]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-3/1","hResidualLocalPhiCSC_ME-3/1",200,-1,1);
00458         hResidualLocalThetaCSC_ME[2]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-3/1","hResidualLocalThetaCSC_ME-3/1",200,-1,1);
00459         hResidualLocalYCSC_ME[2] = fs->make<TH1F>("hResidualLocalYCSC_ME-3/1","hResidualLocalYCSC_ME-3/1",200,-10,10);
00460         hResidualLocalXCSC_ME[3]=fs->make<TH1F>("hResidualLocalXCSC_ME-3/2","hResidualLocalXCSC_ME-3/2",200,-10,10);
00461         hResidualLocalPhiCSC_ME[3]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-3/2","hResidualLocalPhiCSC_ME-3/2",200,-1,1);
00462         hResidualLocalThetaCSC_ME[3]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-3/2","hResidualLocalThetaCSC_ME-3/2",200,-1,1);
00463         hResidualLocalYCSC_ME[3] = fs->make<TH1F>("hResidualLocalYCSC_ME-3/2","hResidualLocalYCSC_ME-3/2",200,-10,10);
00464         hResidualLocalXCSC_ME[4]=fs->make<TH1F>("hResidualLocalXCSC_ME-2/1","hResidualLocalXCSC_ME-2/1",200,-10,10);
00465         hResidualLocalPhiCSC_ME[4]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-2/1","hResidualLocalPhiCSC_ME-2/1",200,-1,1);
00466         hResidualLocalThetaCSC_ME[4]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-2/1","hResidualLocalThetaCSC_ME-2/1",200,-1,1);
00467         hResidualLocalYCSC_ME[4] = fs->make<TH1F>("hResidualLocalYCSC_ME-2/1","hResidualLocalYCSC_ME-2/1",200,-10,10);
00468         hResidualLocalXCSC_ME[5]=fs->make<TH1F>("hResidualLocalXCSC_ME-2/2","hResidualLocalXCSC_ME-2/2",200,-10,10);
00469         hResidualLocalPhiCSC_ME[5]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-2/2","hResidualLocalPhiCSC_ME-2/2",200,-1,1);
00470         hResidualLocalThetaCSC_ME[5]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-2/2","hResidualLocalThetaCSC_ME-2/2",200,-1,1);
00471         hResidualLocalYCSC_ME[5] = fs->make<TH1F>("hResidualLocalYCSC_ME-2/2","hResidualLocalYCSC_ME-2/2",200,-10,10);
00472         hResidualLocalXCSC_ME[6]=fs->make<TH1F>("hResidualLocalXCSC_ME-1/1","hResidualLocalXCSC_ME-1/1",200,-10,10);
00473         hResidualLocalPhiCSC_ME[6]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-1/1","hResidualLocalPhiCSC_ME-1/1",200,-1,1);
00474         hResidualLocalThetaCSC_ME[6]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-1/1","hResidualLocalThetaCSC_ME-1/1",200,-1,1);
00475         hResidualLocalYCSC_ME[6] = fs->make<TH1F>("hResidualLocalYCSC_ME-1/1","hResidualLocalYCSC_ME-1/1",200,-10,10);
00476         hResidualLocalXCSC_ME[7]=fs->make<TH1F>("hResidualLocalXCSC_ME-1/2","hResidualLocalXCSC_ME-1/2",200,-10,10);
00477         hResidualLocalPhiCSC_ME[7]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-1/2","hResidualLocalPhiCSC_ME-1/2",200,-1,1);
00478         hResidualLocalThetaCSC_ME[7]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-1/2","hResidualLocalThetaCSC_ME-1/2",200,-1,1);
00479         hResidualLocalYCSC_ME[7] = fs->make<TH1F>("hResidualLocalYCSC_ME-1/2","hResidualLocalYCSC_ME-1/2",200,-10,10);
00480         hResidualLocalXCSC_ME[8]=fs->make<TH1F>("hResidualLocalXCSC_ME-1/3","hResidualLocalXCSC_ME-1/3",200,-10,10);
00481         hResidualLocalPhiCSC_ME[8]=fs->make<TH1F>("hResidualLocalPhiCSC_ME-1/3","hResidualLocalPhiCSC_ME-1/3",200,-1,1);
00482         hResidualLocalThetaCSC_ME[8]=fs->make<TH1F>("hResidualLocalThetaCSC_ME-1/3","hResidualLocalThetaCSC_ME-1/3",200,-1,1);
00483         hResidualLocalYCSC_ME[8] = fs->make<TH1F>("hResidualLocalYCSC_ME-1/3","hResidualLocalYCSC_ME-1/3",200,-10,10);
00484         hResidualLocalXCSC_ME[9]=fs->make<TH1F>("hResidualLocalXCSC_ME1/1","hResidualLocalXCSC_ME1/1",200,-10,10);
00485         hResidualLocalPhiCSC_ME[9]=fs->make<TH1F>("hResidualLocalPhiCSC_ME1/1","hResidualLocalPhiCSC_ME1/1",100,-1,1);
00486         hResidualLocalThetaCSC_ME[9]=fs->make<TH1F>("hResidualLocalThetaCSC_ME1/1","hResidualLocalThetaCSC_ME1/1",200,-1,1);
00487         hResidualLocalYCSC_ME[9] = fs->make<TH1F>("hResidualLocalYCSC_ME1/1","hResidualLocalYCSC_ME1/1",200,-10,10);
00488         hResidualLocalXCSC_ME[10]=fs->make<TH1F>("hResidualLocalXCSC_ME1/2","hResidualLocalXCSC_ME1/2",200,-10,10);
00489         hResidualLocalPhiCSC_ME[10]=fs->make<TH1F>("hResidualLocalPhiCSC_ME1/2","hResidualLocalPhiCSC_ME1/2",200,-1,1);
00490         hResidualLocalThetaCSC_ME[10]=fs->make<TH1F>("hResidualLocalThetaCSC_ME1/2","hResidualLocalThetaCSC_ME1/2",200,-1,1);
00491         hResidualLocalYCSC_ME[10] = fs->make<TH1F>("hResidualLocalYCSC_ME1/2","hResidualLocalYCSC_ME1/2",200,-10,10);
00492         hResidualLocalXCSC_ME[11]=fs->make<TH1F>("hResidualLocalXCSC_ME1/3","hResidualLocalXCSC_ME1/3",200,-10,10);
00493         hResidualLocalPhiCSC_ME[11]=fs->make<TH1F>("hResidualLocalPhiCSC_ME1/3","hResidualLocalPhiCSC_ME1/3",200,-1,1);
00494         hResidualLocalThetaCSC_ME[11]=fs->make<TH1F>("hResidualLocalThetaCSC_ME1/3","hResidualLocalThetaCSC_ME1/3",200,-1,1);
00495         hResidualLocalYCSC_ME[11] = fs->make<TH1F>("hResidualLocalYCSC_ME1/3","hResidualLocalYCSC_ME1/3",200,-10,10);
00496         hResidualLocalXCSC_ME[12]=fs->make<TH1F>("hResidualLocalXCSC_ME2/1","hResidualLocalXCSC_ME2/1",200,-10,10);
00497         hResidualLocalPhiCSC_ME[12]=fs->make<TH1F>("hResidualLocalPhiCSC_ME2/1","hResidualLocalPhiCSC_ME2/1",200,-1,1);
00498         hResidualLocalThetaCSC_ME[12]=fs->make<TH1F>("hResidualLocalThetaCSC_ME2/1","hResidualLocalThetaCSC_ME2/1",200,-1,1);
00499         hResidualLocalYCSC_ME[12] = fs->make<TH1F>("hResidualLocalYCSC_ME2/1","hResidualLocalYCSC_ME2/1",200,-10,10);
00500         hResidualLocalXCSC_ME[13]=fs->make<TH1F>("hResidualLocalXCSC_ME2/2","hResidualLocalXCSC_ME2/2",200,-10,10);
00501         hResidualLocalPhiCSC_ME[13]=fs->make<TH1F>("hResidualLocalPhiCSC_ME2/2","hResidualLocalPhiCSC_ME2/2",200,-1,1);
00502         hResidualLocalThetaCSC_ME[13]=fs->make<TH1F>("hResidualLocalThetaCSC_ME2/2","hResidualLocalThetaCSC_ME2/2",200,-1,1);
00503         hResidualLocalYCSC_ME[13] = fs->make<TH1F>("hResidualLocalYCSC_ME2/2","hResidualLocalYCSC_ME2/2",200,-10,10);
00504         hResidualLocalXCSC_ME[14]=fs->make<TH1F>("hResidualLocalXCSC_ME3/1","hResidualLocalXCSC_ME3/1",200,-10,10);
00505         hResidualLocalPhiCSC_ME[14]=fs->make<TH1F>("hResidualLocalPhiCSC_ME3/1","hResidualLocalPhiCSC_ME3/1",200,-1,1);
00506         hResidualLocalThetaCSC_ME[14]=fs->make<TH1F>("hResidualLocalThetaCSC_ME3/1","hResidualLocalThetaCSC_ME3/1",200,-1,1);
00507         hResidualLocalYCSC_ME[14] = fs->make<TH1F>("hResidualLocalYCSC_ME3/1","hResidualLocalYCSC_ME3/1",200,-10,10);
00508         hResidualLocalXCSC_ME[15]=fs->make<TH1F>("hResidualLocalXCSC_ME3/2","hResidualLocalXCSC_ME3/2",200,-10,10);
00509         hResidualLocalPhiCSC_ME[15]=fs->make<TH1F>("hResidualLocalPhiCSC_ME3/2","hResidualLocalPhiCSC_ME3/2",200,-1,1);
00510         hResidualLocalThetaCSC_ME[15]=fs->make<TH1F>("hResidualLocalThetaCSC_ME3/2","hResidualLocalThetaCSC_ME3/2",200,-1,1);
00511         hResidualLocalYCSC_ME[15] = fs->make<TH1F>("hResidualLocalYCSC_ME3/2","hResidualLocalYCSC_ME3/2",200,-10,10);
00512         hResidualLocalXCSC_ME[16]=fs->make<TH1F>("hResidualLocalXCSC_ME4/1","hResidualLocalXCSC_ME4/1",200,-10,10);
00513         hResidualLocalPhiCSC_ME[16]=fs->make<TH1F>("hResidualLocalPhiCSC_ME4/1","hResidualLocalPhiCSC_ME4/1",200,-1,1);
00514         hResidualLocalThetaCSC_ME[16]=fs->make<TH1F>("hResidualLocalThetaCSC_ME4/1","hResidualLocalThetaCSC_ME4/1",200,-1,1);
00515         hResidualLocalYCSC_ME[16] = fs->make<TH1F>("hResidualLocalYCSC_ME4/1","hResidualLocalYCSC_ME4/1",200,-10,10);
00516         hResidualLocalXCSC_ME[17]=fs->make<TH1F>("hResidualLocalXCSC_ME4/2","hResidualLocalXCSC_ME4/2",200,-10,10);
00517         hResidualLocalPhiCSC_ME[17]=fs->make<TH1F>("hResidualLocalPhiCSC_ME4/2","hResidualLocalPhiCSC_ME4/2",200,-1,1);
00518         hResidualLocalThetaCSC_ME[17]=fs->make<TH1F>("hResidualLocalThetaCSC_ME4/2","hResidualLocalThetaCSC_ME4/2",200,-1,1);
00519         hResidualLocalYCSC_ME[17] = fs->make<TH1F>("hResidualLocalYCSC_ME4/2","hResidualLocalYCSC_ME4/2",200,-10,10);
00520         hResidualGlobalRPhiCSC_ME[0]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-4/1","hResidualGlobalRPhiCSC_ME-4/1",200,-10,10);
00521         hResidualGlobalPhiCSC_ME[0]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-4/1","hResidualGlobalPhiCSC_ME-4/1",200,-1,1);
00522         hResidualGlobalThetaCSC_ME[0]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-4/1","hResidualGlobalThetaCSC_ME-4/1",200,-1,1);
00523         hResidualGlobalRCSC_ME[0] = fs->make<TH1F>("hResidualGlobalRCSC_ME-4/1","hResidualGlobalRCSC_ME-4/1",200,-10,10);
00524         hResidualGlobalRPhiCSC_ME[1]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-4/2","hResidualGlobalRPhiCSC_ME-4/2",200,-10,10);
00525         hResidualGlobalPhiCSC_ME[1]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-4/2","hResidualGlobalPhiCSC_ME-4/2",200,-1,1);
00526         hResidualGlobalThetaCSC_ME[1]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-4/2","hResidualGlobalThetaCSC_ME-4/2",200,-1,1);
00527         hResidualGlobalRCSC_ME[1] = fs->make<TH1F>("hResidualGlobalRCSC_ME-4/2","hResidualGlobalRCSC_ME-4/2",200,-10,10);
00528         hResidualGlobalRPhiCSC_ME[2]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-3/1","hResidualGlobalRPhiCSC_ME-3/1",200,-10,10);
00529         hResidualGlobalPhiCSC_ME[2]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-3/1","hResidualGlobalPhiCSC_ME-3/1",200,-1,1);
00530         hResidualGlobalThetaCSC_ME[2]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-3/1","hResidualGlobalThetaCSC_ME-3/1",200,-1,1);
00531         hResidualGlobalRCSC_ME[2] = fs->make<TH1F>("hResidualGlobalRCSC_ME-3/1","hResidualGlobalRCSC_ME-3/1",200,-10,10);
00532         hResidualGlobalRPhiCSC_ME[3]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-3/2","hResidualGlobalRPhiCSC_ME-3/2",200,-10,10);
00533         hResidualGlobalPhiCSC_ME[3]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-3/2","hResidualGlobalPhiCSC_ME-3/2",200,-1,1);
00534         hResidualGlobalThetaCSC_ME[3]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-3/2","hResidualGlobalThetaCSC_ME-3/2",200,-1,1);
00535         hResidualGlobalRCSC_ME[3] = fs->make<TH1F>("hResidualGlobalRCSC_ME-3/2","hResidualGlobalRCSC_ME-3/2",200,-10,10);
00536         hResidualGlobalRPhiCSC_ME[4]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-2/1","hResidualGlobalRPhiCSC_ME-2/1",200,-10,10);
00537         hResidualGlobalPhiCSC_ME[4]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-2/1","hResidualGlobalPhiCSC_ME-2/1",200,-1,1);
00538         hResidualGlobalThetaCSC_ME[4]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-2/1","hResidualGlobalThetaCSC_ME-2/1",200,-1,1);
00539         hResidualGlobalRCSC_ME[4] = fs->make<TH1F>("hResidualGlobalRCSC_ME-2/1","hResidualGlobalRCSC_ME-2/1",200,-10,10);
00540         hResidualGlobalRPhiCSC_ME[5]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-2/2","hResidualGlobalRPhiCSC_ME-2/2",200,-10,10);
00541         hResidualGlobalPhiCSC_ME[5]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-2/2","hResidualGlobalPhiCSC_ME-2/2",200,-1,1);
00542         hResidualGlobalThetaCSC_ME[5]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-2/2","hResidualGlobalThetaCSC_ME-2/2",200,-1,1);
00543         hResidualGlobalRCSC_ME[5] = fs->make<TH1F>("hResidualGlobalRCSC_ME-2/2","hResidualGlobalRCSC_ME-2/2",200,-10,10);
00544         hResidualGlobalRPhiCSC_ME[6]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-1/1","hResidualGlobalRPhiCSC_ME-1/1",200,-10,10);
00545         hResidualGlobalPhiCSC_ME[6]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-1/1","hResidualGlobalPhiCSC_ME-1/1",200,-1,1);
00546         hResidualGlobalThetaCSC_ME[6]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-1/1","hResidualGlobalThetaCSC_ME-1/1",200,-1,1);
00547         hResidualGlobalRCSC_ME[6] = fs->make<TH1F>("hResidualGlobalRCSC_ME-1/1","hResidualGlobalRCSC_ME-1/1",200,-10,10);
00548         hResidualGlobalRPhiCSC_ME[7]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-1/2","hResidualGlobalRPhiCSC_ME-1/2",200,-10,10);
00549         hResidualGlobalPhiCSC_ME[7]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-1/2","hResidualGlobalPhiCSC_ME-1/2",200,-1,1);
00550         hResidualGlobalThetaCSC_ME[7]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-1/2","hResidualGlobalThetaCSC_ME-1/2",200,-1,1);
00551         hResidualGlobalRCSC_ME[7] = fs->make<TH1F>("hResidualGlobalRCSC_ME-1/2","hResidualGlobalRCSC_ME-1/2",200,-10,10);
00552         hResidualGlobalRPhiCSC_ME[8]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME-1/3","hResidualGlobalRPhiCSC_ME-1/3",200,-10,10);
00553         hResidualGlobalPhiCSC_ME[8]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME-1/3","hResidualGlobalPhiCSC_ME-1/3",200,-1,1);
00554         hResidualGlobalThetaCSC_ME[8]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME-1/3","hResidualGlobalThetaCSC_ME-1/3",200,-1,1);
00555         hResidualGlobalRCSC_ME[8] = fs->make<TH1F>("hResidualGlobalRCSC_ME-1/3","hResidualGlobalRCSC_ME-1/3",200,-10,10);
00556         hResidualGlobalRPhiCSC_ME[9]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME1/1","hResidualGlobalRPhiCSC_ME1/1",200,-10,10);
00557         hResidualGlobalPhiCSC_ME[9]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME1/1","hResidualGlobalPhiCSC_ME1/1",100,-1,1);
00558         hResidualGlobalThetaCSC_ME[9]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME1/1","hResidualGlobalThetaCSC_ME1/1",200,-1,1);
00559         hResidualGlobalRCSC_ME[9] = fs->make<TH1F>("hResidualGlobalRCSC_ME1/1","hResidualGlobalRCSC_ME1/1",200,-10,10);
00560         hResidualGlobalRPhiCSC_ME[10]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME1/2","hResidualGlobalRPhiCSC_ME1/2",200,-10,10);
00561         hResidualGlobalPhiCSC_ME[10]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME1/2","hResidualGlobalPhiCSC_ME1/2",200,-1,1);
00562         hResidualGlobalThetaCSC_ME[10]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME1/2","hResidualGlobalThetaCSC_ME1/2",200,-1,1);
00563         hResidualGlobalRCSC_ME[10] = fs->make<TH1F>("hResidualGlobalRCSC_ME1/2","hResidualGlobalRCSC_ME1/2",200,-10,10);
00564         hResidualGlobalRPhiCSC_ME[11]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME1/3","hResidualGlobalRPhiCSC_ME1/3",200,-10,10);
00565         hResidualGlobalPhiCSC_ME[11]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME1/3","hResidualGlobalPhiCSC_ME1/3",200,-1,1);
00566         hResidualGlobalThetaCSC_ME[11]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME1/3","hResidualGlobalThetaCSC_ME1/3",200,-1,1);
00567         hResidualGlobalRCSC_ME[11] = fs->make<TH1F>("hResidualGlobalRCSC_ME1/3","hResidualGlobalRCSC_ME1/3",200,-10,10);
00568         hResidualGlobalRPhiCSC_ME[12]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME2/1","hResidualGlobalRPhiCSC_ME2/1",200,-10,10);
00569         hResidualGlobalPhiCSC_ME[12]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME2/1","hResidualGlobalPhiCSC_ME2/1",200,-1,1);
00570         hResidualGlobalThetaCSC_ME[12]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME2/1","hResidualGlobalThetaCSC_ME2/1",200,-1,1);
00571         hResidualGlobalRCSC_ME[12] = fs->make<TH1F>("hResidualGlobalRCSC_ME2/1","hResidualGlobalRCSC_ME2/1",200,-10,10);
00572         hResidualGlobalRPhiCSC_ME[13]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME2/2","hResidualGlobalRPhiCSC_ME2/2",200,-10,10);
00573         hResidualGlobalPhiCSC_ME[13]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME2/2","hResidualGlobalPhiCSC_ME2/2",200,-1,1);
00574         hResidualGlobalThetaCSC_ME[13]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME2/2","hResidualGlobalThetaCSC_ME2/2",200,-1,1);
00575         hResidualGlobalRCSC_ME[13] = fs->make<TH1F>("hResidualGlobalRCSC_ME2/2","hResidualGlobalRCSC_ME2/2",200,-10,10);
00576         hResidualGlobalRPhiCSC_ME[14]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME3/1","hResidualGlobalRPhiCSC_ME3/1",200,-10,10);
00577         hResidualGlobalPhiCSC_ME[14]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME3/1","hResidualGlobalPhiCSC_ME3/1",200,-1,1);
00578         hResidualGlobalThetaCSC_ME[14]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME3/1","hResidualGlobalThetaCSC_ME3/1",200,-1,1);
00579         hResidualGlobalRCSC_ME[14] = fs->make<TH1F>("hResidualGlobalRCSC_ME3/1","hResidualGlobalRCSC_ME3/1",200,-10,10);
00580         hResidualGlobalRPhiCSC_ME[15]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME3/2","hResidualGlobalRPhiCSC_ME3/2",200,-10,10);
00581         hResidualGlobalPhiCSC_ME[15]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME3/2","hResidualGlobalPhiCSC_ME3/2",200,-1,1);
00582         hResidualGlobalThetaCSC_ME[15]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME3/2","hResidualGlobalThetaCSC_ME3/2",200,-1,1);
00583         hResidualGlobalRCSC_ME[15] = fs->make<TH1F>("hResidualGlobalRCSC_ME3/2","hResidualGlobalRCSC_ME3/2",200,-10,10);
00584         hResidualGlobalRPhiCSC_ME[16]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME4/1","hResidualGlobalRPhiCSC_ME4/1",200,-10,10);
00585         hResidualGlobalPhiCSC_ME[16]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME4/1","hResidualGlobalPhiCSC_ME4/1",200,-1,1);
00586         hResidualGlobalThetaCSC_ME[16]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME4/1","hResidualGlobalThetaCSC_ME4/1",200,-1,1);
00587         hResidualGlobalRCSC_ME[16] = fs->make<TH1F>("hResidualGlobalRCSC_ME4/1","hResidualGlobalRCSC_ME4/1",200,-10,10);
00588         hResidualGlobalRPhiCSC_ME[17]=fs->make<TH1F>("hResidualGlobalRPhiCSC_ME4/2","hResidualGlobalRPhiCSC_ME4/2",200,-10,10);
00589         hResidualGlobalPhiCSC_ME[17]=fs->make<TH1F>("hResidualGlobalPhiCSC_ME4/2","hResidualGlobalPhiCSC_ME4/2",200,-1,1);
00590         hResidualGlobalThetaCSC_ME[17]=fs->make<TH1F>("hResidualGlobalThetaCSC_ME4/2","hResidualGlobalThetaCSC_ME4/2",200,-1,1);
00591         hResidualGlobalRCSC_ME[17] = fs->make<TH1F>("hResidualGlobalRCSC_ME4/2","hResidualGlobalRCSC_ME4/2",200,-10,10);
00592 
00593         //DQM plots: mean residual with RMS as error
00594         hprofLocalXDT=fs->make<TH1F>("hprofLocalXDT","Local X DT;;X (cm)", 280,0, 280);
00595         hprofLocalPhiDT=fs->make<TH1F>("hprofLocalPhiDT","Local Phi DT;;Phi (rad)", 280,0, 280);
00596         hprofLocalThetaDT=fs->make<TH1F>("hprofLocalThetaDT","Local Theta DT;;Theta (rad)", 280,0, 280);
00597         hprofLocalYDT=fs->make<TH1F>("hprofLocalYDT","Local Y DT;;Y (cm)", 280,0, 280);
00598         hprofLocalXCSC=fs->make<TH1F>("hprofLocalXCSC","Local X CSC;;X (cm)", 540,0, 540);
00599         hprofLocalPhiCSC=fs->make<TH1F>("hprofLocalPhiCSC","Local Phi CSC;;Phi (rad)", 540,0, 540);
00600         hprofLocalThetaCSC=fs->make<TH1F>("hprofLocalThetaCSC","Local Theta CSC;;Theta (rad)", 540,0, 540);
00601         hprofLocalYCSC=fs->make<TH1F>("hprofLocalYCSC","Local Y CSC;;Y (cm)", 540,0, 540);
00602         hprofGlobalRPhiDT=fs->make<TH1F>("hprofGlobalRPhiDT","Global RPhi DT;;RPhi (cm)", 280,0, 280);
00603         hprofGlobalPhiDT=fs->make<TH1F>("hprofGlobalPhiDT","Global Phi DT;;Phi (rad)", 280,0, 280);
00604         hprofGlobalThetaDT=fs->make<TH1F>("hprofGlobalThetaDT","Global Theta DT;;Theta (rad)", 280,0, 280);
00605         hprofGlobalZDT=fs->make<TH1F>("hprofGlobalZDT","Global Z DT;;Z (cm)", 280,0, 280);
00606         hprofGlobalRPhiCSC=fs->make<TH1F>("hprofGlobalRPhiCSC","Global RPhi CSC;;RPhi (cm)", 540,0, 540);
00607         hprofGlobalPhiCSC=fs->make<TH1F>("hprofGlobalPhiCSC","Global Phi CSC;;Phi (cm)", 540,0, 540);
00608         hprofGlobalThetaCSC=fs->make<TH1F>("hprofGlobalThetaCSC","Global Theta CSC;;Theta (rad)", 540,0, 540);
00609         hprofGlobalRCSC=fs->make<TH1F>("hprofGlobalRCSC","Global R CSC;;R (cm)", 540,0, 540);
00610 
00611         // TH1F options
00612         hprofLocalXDT->GetXaxis()->SetLabelSize(0.025);
00613         hprofLocalPhiDT->GetXaxis()->SetLabelSize(0.025);
00614         hprofLocalThetaDT->GetXaxis()->SetLabelSize(0.025);
00615         hprofLocalYDT->GetXaxis()->SetLabelSize(0.025);
00616         hprofLocalXCSC->GetXaxis()->SetLabelSize(0.025);
00617         hprofLocalPhiCSC->GetXaxis()->SetLabelSize(0.025);
00618         hprofLocalThetaCSC->GetXaxis()->SetLabelSize(0.025);
00619         hprofLocalYCSC->GetXaxis()->SetLabelSize(0.025);
00620         hprofGlobalRPhiDT->GetXaxis()->SetLabelSize(0.025);
00621         hprofGlobalPhiDT->GetXaxis()->SetLabelSize(0.025);
00622         hprofGlobalThetaDT->GetXaxis()->SetLabelSize(0.025);
00623         hprofGlobalZDT->GetXaxis()->SetLabelSize(0.025);
00624         hprofGlobalRPhiCSC->GetXaxis()->SetLabelSize(0.025);
00625         hprofGlobalPhiCSC->GetXaxis()->SetLabelSize(0.025);
00626         hprofGlobalThetaCSC->GetXaxis()->SetLabelSize(0.025);
00627         hprofGlobalRCSC->GetXaxis()->SetLabelSize(0.025);
00628   
00629         // TH2F histos definition
00630         hprofGlobalPositionDT=fs->make<TH2F>("hprofGlobalPositionDT","Global DT position (cm) absolute MEAN residuals;Sector;;cm", 14,0, 14,40,0,40);
00631         hprofGlobalAngleDT=fs->make<TH2F>("hprofGlobalAngleDT","Global DT angle (rad) absolute MEAN residuals;Sector;;rad", 14,0, 14,40,0,40); 
00632         hprofGlobalPositionRmsDT=fs->make<TH2F>("hprofGlobalPositionRmsDT","Global DT position (cm) RMS residuals;Sector;;rad", 14,0, 14,40,0,40);
00633         hprofGlobalAngleRmsDT=fs->make<TH2F>("hprofGlobalAngleRmsDT","Global DT angle (rad) RMS residuals;Sector;;rad", 14,0, 14,40,0,40); 
00634         hprofLocalPositionDT=fs->make<TH2F>("hprofLocalPositionDT","Local DT position (cm) absolute MEAN residuals;Sector;;cm", 14,0, 14,40,0,40);
00635         hprofLocalAngleDT=fs->make<TH2F>("hprofLocalAngleDT","Local DT angle (rad) absolute MEAN residuals;Sector;;rad", 14,0, 14,40,0,40); 
00636         hprofLocalPositionRmsDT=fs->make<TH2F>("hprofLocalPositionRmsDT","Local DT position (cm) RMS residuals;Sector;;rad", 14,0, 14,40,0,40);
00637         hprofLocalAngleRmsDT=fs->make<TH2F>("hprofLocalAngleRmsDT","Local DT angle (rad) RMS residuals;Sector;;rad", 14,0, 14,40,0,40); 
00638 
00639         hprofGlobalPositionCSC=fs->make<TH2F>("hprofGlobalPositionCSC","Global CSC position (cm) absolute MEAN residuals;Sector;;cm", 36,0,36,36,0,36);
00640         hprofGlobalAngleCSC=fs->make<TH2F>("hprofGlobalAngleCSC","Global CSC angle (rad) absolute MEAN residuals;Sector;;rad", 36,0,36,36,0,36); 
00641         hprofGlobalPositionRmsCSC=fs->make<TH2F>("hprofGlobalPositionRmsCSC","Global CSC position (cm) RMS residuals;Sector;;rad", 36,0,36,36,0,36);
00642         hprofGlobalAngleRmsCSC=fs->make<TH2F>("hprofGlobalAngleRmsCSC","Global CSC angle (rad) RMS residuals;Sector;;rad", 36,0,36,36,0,36); 
00643         hprofLocalPositionCSC=fs->make<TH2F>("hprofLocalPositionCSC","Local CSC position (cm) absolute MEAN residuals;Sector;;cm", 36,0,36,36,0,36);
00644         hprofLocalAngleCSC=fs->make<TH2F>("hprofLocalAngleCSC","Local CSC angle (rad) absolute MEAN residuals;Sector;;rad", 36,0,36,36,0,36); 
00645         hprofLocalPositionRmsCSC=fs->make<TH2F>("hprofLocalPositionRmsCSC","Local CSC position (cm) RMS residuals;Sector;;rad", 36,0,36,36,0,36);
00646         hprofLocalAngleRmsCSC=fs->make<TH2F>("hprofLocalAngleRmsCSC","Local CSC angle (rad) RMS residuals;Sector;;rad", 36,0,36,36,0,36); 
00647 
00648         // histos options
00649         Float_t labelSize=0.025;
00650         hprofGlobalPositionDT->GetYaxis()->SetLabelSize(labelSize);
00651         hprofGlobalAngleDT->GetYaxis()->SetLabelSize(labelSize);
00652         hprofGlobalPositionRmsDT->GetYaxis()->SetLabelSize(labelSize);
00653         hprofGlobalAngleRmsDT->GetYaxis()->SetLabelSize(labelSize);
00654         hprofLocalPositionDT->GetYaxis()->SetLabelSize(labelSize);
00655         hprofLocalAngleDT->GetYaxis()->SetLabelSize(labelSize);
00656         hprofLocalPositionRmsDT->GetYaxis()->SetLabelSize(labelSize);
00657         hprofLocalAngleRmsDT->GetYaxis()->SetLabelSize(labelSize);
00658 
00659         hprofGlobalPositionCSC->GetYaxis()->SetLabelSize(labelSize);
00660         hprofGlobalAngleCSC->GetYaxis()->SetLabelSize(labelSize);
00661         hprofGlobalPositionRmsCSC->GetYaxis()->SetLabelSize(labelSize);
00662         hprofGlobalAngleRmsCSC->GetYaxis()->SetLabelSize(labelSize);
00663         hprofLocalPositionCSC->GetYaxis()->SetLabelSize(labelSize);
00664         hprofLocalAngleCSC->GetYaxis()->SetLabelSize(labelSize);
00665         hprofLocalPositionRmsCSC->GetYaxis()->SetLabelSize(labelSize);
00666         hprofLocalAngleRmsCSC->GetYaxis()->SetLabelSize(labelSize);
00667 
00668         char binLabel[15];
00669         for (int i=1;i<15;i++){
00670             sprintf(binLabel, "Sec-%d", i );
00671             hprofGlobalPositionDT->GetXaxis()->SetBinLabel(i,binLabel);
00672             hprofGlobalAngleDT->GetXaxis()->SetBinLabel(i,binLabel);
00673             hprofGlobalPositionRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
00674             hprofGlobalAngleRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
00675             hprofLocalPositionDT->GetXaxis()->SetBinLabel(i,binLabel);
00676             hprofLocalAngleDT->GetXaxis()->SetBinLabel(i,binLabel);
00677             hprofLocalPositionRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
00678             hprofLocalAngleRmsDT->GetXaxis()->SetBinLabel(i,binLabel);
00679         }
00680   
00681         for (int i=1;i<37;i++){
00682             sprintf(binLabel, "Ch-%d", i );
00683             hprofGlobalPositionCSC->GetXaxis()->SetBinLabel(i,binLabel);
00684             hprofGlobalAngleCSC->GetXaxis()->SetBinLabel(i,binLabel);
00685             hprofGlobalPositionRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
00686             hprofGlobalAngleRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
00687             hprofLocalPositionCSC->GetXaxis()->SetBinLabel(i,binLabel);
00688             hprofLocalAngleCSC->GetXaxis()->SetBinLabel(i,binLabel);
00689             hprofLocalPositionRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
00690             hprofLocalAngleRmsCSC->GetXaxis()->SetBinLabel(i,binLabel);
00691         }
00692   
00693     }
00694 
00695 }
00696 
00697 void MuonAlignmentAnalyzer::endJob(){
00698 
00699 
00700     edm::LogInfo("MuonAlignmentAnalyzer")  << "----------------- " << std::endl << std::endl;
00701 
00702     if(theDataType == "SimData")
00703         edm::LogInfo("MuonAlignmentAnalyzer")  << "Number of Sim tracks: " << numberOfSimTracks << std::endl << std::endl;
00704 
00705     if(doSAplots)
00706         edm::LogInfo("MuonAlignmentAnalyzer")  << "Number of SA Reco tracks: " << numberOfSARecTracks << std::endl << std::endl;
00707 
00708     if(doGBplots)
00709         edm::LogInfo("MuonAlignmentAnalyzer")  << "Number of GB Reco tracks: " << numberOfGBRecTracks << std::endl << std::endl;
00710 
00711     if(doResplots){
00712 
00713 //  delete thePropagator;
00714 
00715         edm::LogInfo("MuonAlignmentAnalyzer")  << "Number of Hits considered for residuals: " << numberOfHits << std::endl << std::endl;
00716 
00717 
00718 
00719         char binLabel[15];
00720 
00721         for(unsigned int i=0 ; i<unitsLocalX.size() ; i++)
00722         {
00723 
00724             TString nameHistoLocalX=unitsLocalX[i]->GetName();
00725 
00726             TString nameHistoLocalPhi=unitsLocalPhi[i]->GetName();
00727 
00728             TString nameHistoLocalTheta=unitsLocalTheta[i]->GetName();
00729 
00730             TString nameHistoLocalY=unitsLocalY[i]->GetName();
00731 
00732             TString nameHistoGlobalRPhi=unitsGlobalRPhi[i]->GetName();
00733 
00734             TString nameHistoGlobalPhi=unitsGlobalPhi[i]->GetName();
00735 
00736             TString nameHistoGlobalTheta=unitsGlobalTheta[i]->GetName();
00737 
00738             TString nameHistoGlobalRZ=unitsGlobalRZ[i]->GetName();
00739 
00740             if (nameHistoLocalX.Contains("MB")) // HistoLocalX DT
00741             {
00742                 int wheel, station, sector;
00743 
00744                 sscanf(nameHistoLocalX, "ResidualLocalX_W%dMB%1dS%d",&wheel,&station,&sector);
00745 
00746                 Int_t nstation=station - 1;
00747                 Int_t nwheel=wheel+2;
00748 
00749                 Double_t MeanRPhi=unitsLocalX[i]->GetMean();
00750                 Double_t ErrorRPhi=unitsLocalX[i]->GetMeanError();
00751 
00752                 Int_t xbin=sector+14*nstation+14*4*nwheel;
00753 
00754                 sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
00755 
00756                 hprofLocalXDT->SetMarkerStyle(21);
00757                 hprofLocalXDT->SetMarkerColor(kRed);
00758                 hprofLocalXDT->SetBinContent(xbin,MeanRPhi);
00759                 hprofLocalXDT->SetBinError(xbin, ErrorRPhi);
00760                 hprofLocalXDT->GetXaxis()->SetBinLabel(xbin, binLabel);
00761 
00762                 Int_t ybin=1+nwheel*8+nstation*2;
00763                 hprofLocalPositionDT->SetBinContent(sector,ybin,fabs(MeanRPhi));
00764                 sprintf(binLabel, "MB%d/%d_LocalX",wheel, station );
00765                 hprofLocalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00766                 hprofLocalPositionRmsDT->SetBinContent(sector,ybin,ErrorRPhi);
00767                 hprofLocalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00768             }
00769 
00770             if (nameHistoLocalX.Contains("ME")) // HistoLocalX CSC
00771             {
00772 
00773                 int station, ring, chamber;
00774 
00775                 sscanf(nameHistoLocalX, "ResidualLocalX_ME%dR%1dC%d",&station,&ring,&chamber);
00776 
00777                 Double_t MeanRPhi=unitsLocalX[i]->GetMean();
00778                 Double_t ErrorRPhi=unitsLocalX[i]->GetMeanError();
00779 
00780                 Int_t xbin=abs(station)*2+ring;
00781                 if(abs(station)==1) xbin=ring;
00782                 if (station>0) xbin=xbin+9;
00783                 else xbin = 10 -xbin;
00784 
00785                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
00786                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
00787                 else if(xbin<6) xbin=108+chamber;
00788                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
00789                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
00790                 else xbin=522+chamber;
00791 
00792                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
00793 
00794                 hprofLocalXCSC->SetMarkerStyle(21);
00795                 hprofLocalXCSC->SetMarkerColor(kRed);
00796                 hprofLocalXCSC->SetBinContent(xbin,MeanRPhi);
00797                 hprofLocalXCSC->SetBinError(xbin, ErrorRPhi);
00798                 hprofLocalXCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
00799 
00800                 Int_t ybin=abs(station)*2+ring;
00801                 if(abs(station)==1) ybin=ring;
00802                 if (station>0) ybin=ybin+9;
00803                 else ybin = 10 -ybin;
00804                 ybin=2*ybin-1;
00805                 hprofLocalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanRPhi));
00806                 sprintf(binLabel, "ME%d/%d_LocalX", station,ring );
00807                 hprofLocalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
00808                 hprofLocalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorRPhi);
00809                 hprofLocalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
00810             }
00811 
00812             if (nameHistoLocalTheta.Contains("MB")) // HistoLocalTheta DT
00813             {   
00814 
00815                 int wheel, station, sector;
00816 
00817                 sscanf(nameHistoLocalTheta, "ResidualLocalTheta_W%dMB%1dS%d",&wheel,&station,&sector);
00818 
00819                 if(station != 4){
00820                     Int_t nstation=station - 1;
00821                     Int_t nwheel=wheel+2;
00822 
00823                     Double_t MeanTheta=unitsLocalTheta[i]->GetMean();
00824                     Double_t ErrorTheta=unitsLocalTheta[i]->GetMeanError();
00825 
00826                     Int_t xbin=sector+14*nstation+14*4*nwheel;
00827 
00828                     sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
00829 
00830                     hprofLocalThetaDT->SetBinContent(xbin,MeanTheta);
00831                     hprofLocalThetaDT->SetBinError(xbin, ErrorTheta);
00832                     hprofLocalThetaDT->SetMarkerStyle(21);
00833                     hprofLocalThetaDT->SetMarkerColor(kRed);
00834                     hprofLocalThetaDT->GetXaxis()->SetBinLabel(xbin, binLabel);
00835 
00836                     Int_t ybin=2+nwheel*8+nstation*2;
00837                     hprofLocalAngleDT->SetBinContent(sector,ybin,fabs(MeanTheta));
00838                     sprintf(binLabel, "MB%d/%d_LocalTheta",wheel,station );
00839                     hprofLocalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00840                     hprofLocalAngleRmsDT->SetBinContent(sector,ybin,ErrorTheta);
00841                     hprofLocalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00842         
00843                 }
00844             }
00845 
00846             if (nameHistoLocalPhi.Contains("MB")) // HistoLocalPhi DT
00847             {   
00848 
00849                 int wheel, station, sector;
00850 
00851                 sscanf(nameHistoLocalPhi, "ResidualLocalPhi_W%dMB%1dS%d",&wheel,&station,&sector);
00852 
00853                 Int_t nstation=station - 1;
00854                 Int_t nwheel=wheel+2;
00855 
00856                 Double_t MeanPhi=unitsLocalPhi[i]->GetMean();
00857                 Double_t ErrorPhi=unitsLocalPhi[i]->GetMeanError();
00858 
00859                 Int_t xbin=sector+14*nstation+14*4*nwheel;
00860 
00861                 sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
00862 
00863                 hprofLocalPhiDT->SetBinContent(xbin,MeanPhi);
00864                 hprofLocalPhiDT->SetBinError(xbin, ErrorPhi);
00865                 hprofLocalPhiDT->SetMarkerStyle(21);
00866                 hprofLocalPhiDT->SetMarkerColor(kRed);
00867                 hprofLocalPhiDT->GetXaxis()->SetBinLabel(xbin, binLabel);
00868         
00869                 Int_t ybin=1+nwheel*8+nstation*2;
00870                 hprofLocalAngleDT->SetBinContent(sector,ybin,fabs(MeanPhi));
00871                 sprintf(binLabel, "MB%d/%d_LocalPhi", wheel,station );
00872                 hprofLocalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00873                 hprofLocalAngleRmsDT->SetBinContent(sector,ybin,ErrorPhi);
00874                 hprofLocalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00875             }
00876 
00877             if (nameHistoLocalPhi.Contains("ME")) // HistoLocalPhi CSC
00878             {
00879 
00880                 int station, ring, chamber;
00881 
00882                 sscanf(nameHistoLocalPhi, "ResidualLocalPhi_ME%dR%1dC%d",&station,&ring,&chamber);
00883 
00884                 Double_t MeanPhi=unitsLocalPhi[i]->GetMean();
00885                 Double_t ErrorPhi=unitsLocalPhi[i]->GetMeanError();
00886 
00887                 Int_t xbin=abs(station)*2+ring;
00888                 if(abs(station)==1) xbin=ring;
00889                 if (station>0) xbin=xbin+9;
00890                 else xbin = 10 -xbin;
00891 
00892                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
00893                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
00894                 else if(xbin<6) xbin=108+chamber;
00895                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
00896                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
00897                 else xbin=522+chamber;
00898 
00899                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
00900 
00901                 hprofLocalPhiCSC->SetMarkerStyle(21);
00902                 hprofLocalPhiCSC->SetMarkerColor(kRed);
00903                 hprofLocalPhiCSC->SetBinContent(xbin,MeanPhi);
00904                 hprofLocalPhiCSC->SetBinError(xbin, ErrorPhi);
00905                 hprofLocalPhiCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
00906 
00907                 Int_t ybin=abs(station)*2+ring;
00908                 if(abs(station)==1) ybin=ring;
00909                 if (station>0) ybin=ybin+9;
00910                 else ybin = 10 -ybin;
00911                 ybin=2*ybin-1;
00912                 hprofLocalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanPhi));
00913                 sprintf(binLabel, "ME%d/%d_LocalPhi", station,ring );
00914                 hprofLocalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
00915                 hprofLocalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorPhi);
00916                 hprofLocalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
00917             }
00918 
00919             if (nameHistoLocalTheta.Contains("ME")) // HistoLocalTheta CSC
00920             {
00921 
00922                 int station, ring, chamber;
00923 
00924                 sscanf(nameHistoLocalTheta, "ResidualLocalTheta_ME%dR%1dC%d",&station,&ring,&chamber);
00925 
00926                 Double_t MeanTheta=unitsLocalTheta[i]->GetMean();
00927                 Double_t ErrorTheta=unitsLocalTheta[i]->GetMeanError();
00928 
00929                 Int_t xbin=abs(station)*2+ring;
00930                 if(abs(station)==1) xbin=ring;
00931                 if (station>0) xbin=xbin+9;
00932                 else xbin = 10 -xbin;
00933 
00934                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
00935                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
00936                 else if(xbin<6) xbin=108+chamber;
00937                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
00938                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
00939                 else xbin=522+chamber;
00940 
00941                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
00942 
00943                 hprofLocalThetaCSC->SetMarkerStyle(21);
00944                 hprofLocalThetaCSC->SetMarkerColor(kRed);
00945                 hprofLocalThetaCSC->SetBinContent(xbin,MeanTheta);
00946                 hprofLocalThetaCSC->SetBinError(xbin, ErrorTheta);
00947                 hprofLocalThetaCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
00948 
00949                 Int_t ybin=abs(station)*2+ring;
00950                 if(abs(station)==1) ybin=ring;
00951                 if (station>0) ybin=ybin+9;
00952                 else ybin = 10 -ybin;
00953                 ybin=2*ybin;
00954                 hprofLocalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanTheta));
00955                 sprintf(binLabel, "ME%d/%d_LocalTheta", station,ring );
00956                 hprofLocalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
00957                 hprofLocalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorTheta);
00958                 hprofLocalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
00959             }
00960 
00961             if (nameHistoLocalY.Contains("MB")) // HistoLocalY DT
00962             {
00963 
00964                 int wheel, station, sector;
00965 
00966                 sscanf(nameHistoLocalY, "ResidualLocalY_W%dMB%1dS%d",&wheel,&station,&sector);
00967 
00968                 if(station!=4){
00969                     Int_t nstation=station - 1;
00970                     Int_t nwheel=wheel+2;
00971 
00972                     Double_t MeanZ=unitsLocalY[i]->GetMean();
00973                     Double_t ErrorZ=unitsLocalY[i]->GetMeanError();
00974 
00975                     Int_t xbin=sector+14*nstation+14*4*nwheel;
00976 
00977                     sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
00978 
00979                     hprofLocalYDT->SetMarkerStyle(21);
00980                     hprofLocalYDT->SetMarkerColor(kRed);
00981                     hprofLocalYDT->SetBinContent(xbin,MeanZ);
00982                     hprofLocalYDT->SetBinError(xbin, ErrorZ);
00983                     hprofLocalYDT->GetXaxis()->SetBinLabel(xbin, binLabel);
00984 
00985                     Int_t ybin=2+nwheel*8+nstation*2;
00986                     hprofLocalPositionDT->SetBinContent(sector,ybin,fabs(MeanZ));
00987                     sprintf(binLabel, "MB%d/%d_LocalY", wheel,station );
00988                     hprofLocalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00989                     hprofLocalPositionRmsDT->SetBinContent(sector,ybin,ErrorZ);
00990                     hprofLocalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
00991                 }
00992             }
00993 
00994             if (nameHistoLocalY.Contains("ME")) // HistoLocalY CSC
00995             {
00996 
00997                 int station, ring, chamber;
00998 
00999                 sscanf(nameHistoLocalY, "ResidualLocalY_ME%dR%1dC%d",&station,&ring,&chamber);
01000 
01001                 Double_t MeanR=unitsLocalY[i]->GetMean();
01002                 Double_t ErrorR=unitsLocalY[i]->GetMeanError();
01003 
01004                 Int_t xbin=abs(station)*2+ring;
01005                 if(abs(station)==1) xbin=ring;
01006                 if (station>0) xbin=xbin+9;
01007                 else xbin = 10 -xbin;
01008 
01009                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
01010                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
01011                 else if(xbin<6) xbin=108+chamber;
01012                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
01013                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
01014                 else xbin=522+chamber;
01015 
01016                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
01017 
01018                 hprofLocalYCSC->SetMarkerStyle(21);
01019                 hprofLocalYCSC->SetMarkerColor(kRed);
01020                 hprofLocalYCSC->SetBinContent(xbin,MeanR);
01021                 hprofLocalYCSC->SetBinError(xbin, ErrorR);
01022                 hprofLocalYCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
01023 
01024                 Int_t ybin=abs(station)*2+ring;
01025                 if(abs(station)==1) ybin=ring;
01026                 if (station>0) ybin=ybin+9;
01027                 else ybin = 10 -ybin;
01028                 ybin=2*ybin;
01029                 hprofLocalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanR));
01030                 sprintf(binLabel, "ME%d/%d_LocalY", station,ring );
01031                 hprofLocalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01032                 hprofLocalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorR);
01033                 hprofLocalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01034             }
01035 
01036             if (nameHistoGlobalRPhi.Contains("MB")) // HistoGlobalRPhi DT
01037             {
01038                 int wheel, station, sector;
01039 
01040                 sscanf(nameHistoGlobalRPhi, "ResidualGlobalRPhi_W%dMB%1dS%d",&wheel,&station,&sector);
01041 
01042                 Int_t nstation=station - 1;
01043                 Int_t nwheel=wheel+2;
01044 
01045                 Double_t MeanRPhi=unitsGlobalRPhi[i]->GetMean();
01046                 Double_t ErrorRPhi=unitsGlobalRPhi[i]->GetMeanError();
01047 
01048                 Int_t xbin=sector+14*nstation+14*4*nwheel;
01049 
01050                 sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
01051 
01052                 hprofGlobalRPhiDT->SetMarkerStyle(21);
01053                 hprofGlobalRPhiDT->SetMarkerColor(kRed);
01054                 hprofGlobalRPhiDT->SetBinContent(xbin,MeanRPhi);
01055                 hprofGlobalRPhiDT->SetBinError(xbin, ErrorRPhi);
01056                 hprofGlobalRPhiDT->GetXaxis()->SetBinLabel(xbin, binLabel);
01057 
01058                 Int_t ybin=1+nwheel*8+nstation*2;
01059                 hprofGlobalPositionDT->SetBinContent(sector,ybin,fabs(MeanRPhi));
01060                 sprintf(binLabel, "MB%d/%d_GlobalRPhi", wheel,station );
01061                 hprofGlobalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01062                 hprofGlobalPositionRmsDT->SetBinContent(sector,ybin,ErrorRPhi);
01063                 hprofGlobalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01064             }
01065 
01066             if (nameHistoGlobalRPhi.Contains("ME")) // HistoGlobalRPhi CSC
01067             {
01068 
01069                 int station, ring, chamber;
01070 
01071                 sscanf(nameHistoGlobalRPhi, "ResidualGlobalRPhi_ME%dR%1dC%d",&station,&ring,&chamber);
01072 
01073                 Double_t MeanRPhi=unitsGlobalRPhi[i]->GetMean();
01074                 Double_t ErrorRPhi=unitsGlobalRPhi[i]->GetMeanError();
01075 
01076                 Int_t xbin=abs(station)*2+ring;
01077                 if(abs(station)==1) xbin=ring;
01078                 if (station>0) xbin=xbin+9;
01079                 else xbin = 10 -xbin;
01080 
01081                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
01082                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
01083                 else if(xbin<6) xbin=108+chamber;
01084                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
01085                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
01086                 else xbin=522+chamber;
01087 
01088                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
01089 
01090                 hprofGlobalRPhiCSC->SetMarkerStyle(21);
01091                 hprofGlobalRPhiCSC->SetMarkerColor(kRed);
01092                 hprofGlobalRPhiCSC->SetBinContent(xbin,MeanRPhi);
01093                 hprofGlobalRPhiCSC->SetBinError(xbin, ErrorRPhi);
01094                 hprofGlobalRPhiCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
01095 
01096                 Int_t ybin=abs(station)*2+ring;
01097                 if(abs(station)==1) ybin=ring;
01098                 if (station>0) ybin=ybin+9;
01099                 else ybin = 10 -ybin;
01100                 ybin=2*ybin-1;
01101                 hprofGlobalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanRPhi));
01102                 sprintf(binLabel, "ME%d/%d_GlobalRPhi", station,ring );
01103                 hprofGlobalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01104                 hprofGlobalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorRPhi);
01105                 hprofGlobalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01106             }
01107 
01108             if (nameHistoGlobalTheta.Contains("MB")) // HistoGlobalRTheta DT
01109             {   
01110 
01111                 int wheel, station, sector;
01112 
01113                 sscanf(nameHistoGlobalTheta, "ResidualGlobalTheta_W%dMB%1dS%d",&wheel,&station,&sector);
01114 
01115                 if(station!=4){
01116                     Int_t nstation=station - 1;
01117                     Int_t nwheel=wheel+2;
01118 
01119                     Double_t MeanTheta=unitsGlobalTheta[i]->GetMean();
01120                     Double_t ErrorTheta=unitsGlobalTheta[i]->GetMeanError();
01121 
01122                     Int_t xbin=sector+14*nstation+14*4*nwheel;
01123 
01124                     sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
01125 
01126                     hprofGlobalThetaDT->SetBinContent(xbin,MeanTheta);
01127                     hprofGlobalThetaDT->SetBinError(xbin, ErrorTheta);
01128                     hprofGlobalThetaDT->SetMarkerStyle(21);
01129                     hprofGlobalThetaDT->SetMarkerColor(kRed);
01130                     hprofGlobalThetaDT->GetXaxis()->SetBinLabel(xbin, binLabel);
01131 
01132                     Int_t ybin=2+nwheel*8+nstation*2;
01133                     hprofGlobalAngleDT->SetBinContent(sector,ybin,fabs(MeanTheta));
01134                     sprintf(binLabel, "MB%d/%d_GlobalTheta", wheel,station );
01135                     hprofGlobalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01136                     hprofGlobalAngleRmsDT->SetBinContent(sector,ybin,ErrorTheta);
01137                     hprofGlobalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01138                 }
01139             }
01140 
01141             if (nameHistoGlobalPhi.Contains("MB")) // HistoGlobalPhi DT
01142             {   
01143 
01144                 int wheel, station, sector;
01145 
01146                 sscanf(nameHistoGlobalPhi, "ResidualGlobalPhi_W%dMB%1dS%d",&wheel,&station,&sector);
01147 
01148                 Int_t nstation=station - 1;
01149                 Int_t nwheel=wheel+2;
01150 
01151                 Double_t MeanPhi=unitsGlobalPhi[i]->GetMean();
01152                 Double_t ErrorPhi=unitsGlobalPhi[i]->GetMeanError();
01153 
01154                 Int_t xbin=sector+14*nstation+14*4*nwheel;
01155 
01156                 sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
01157 
01158                 hprofGlobalPhiDT->SetBinContent(xbin,MeanPhi);
01159                 hprofGlobalPhiDT->SetBinError(xbin, ErrorPhi);
01160                 hprofGlobalPhiDT->SetMarkerStyle(21);
01161                 hprofGlobalPhiDT->SetMarkerColor(kRed);
01162                 hprofGlobalPhiDT->GetXaxis()->SetBinLabel(xbin, binLabel);
01163 
01164                 Int_t ybin=1+nwheel*8+nstation*2;
01165                 hprofGlobalAngleDT->SetBinContent(sector,ybin,fabs(MeanPhi));
01166                 sprintf(binLabel, "MB%d/%d_GlobalPhi", wheel,station );
01167                 hprofGlobalAngleDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01168                 hprofGlobalAngleRmsDT->SetBinContent(sector,ybin,ErrorPhi);
01169                 hprofGlobalAngleRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01170             }
01171 
01172             if (nameHistoGlobalPhi.Contains("ME")) // HistoGlobalPhi CSC
01173             {
01174 
01175                 int station, ring, chamber;
01176 
01177                 sscanf(nameHistoGlobalPhi, "ResidualGlobalPhi_ME%dR%1dC%d",&station,&ring,&chamber);
01178 
01179                 Double_t MeanPhi=unitsGlobalPhi[i]->GetMean();
01180                 Double_t ErrorPhi=unitsGlobalPhi[i]->GetMeanError();
01181 
01182                 Int_t xbin=abs(station)*2+ring;
01183                 if(abs(station)==1) xbin=ring;
01184                 if (station>0) xbin=xbin+9;
01185                 else xbin = 10 -xbin;
01186 
01187                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
01188                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
01189                 else if(xbin<6) xbin=108+chamber;
01190                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
01191                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
01192                 else xbin=522+chamber;
01193 
01194                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
01195 
01196                 hprofGlobalPhiCSC->SetMarkerStyle(21);
01197                 hprofGlobalPhiCSC->SetMarkerColor(kRed);
01198                 hprofGlobalPhiCSC->SetBinContent(xbin,MeanPhi);
01199                 hprofGlobalPhiCSC->SetBinError(xbin, ErrorPhi);
01200                 hprofGlobalPhiCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
01201 
01202                 Int_t ybin=abs(station)*2+ring;
01203                 if(abs(station)==1) ybin=ring;
01204                 if (station>0) ybin=ybin+9;
01205                 else ybin = 10 -ybin;
01206                 ybin=2*ybin-1;
01207                 hprofGlobalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanPhi));
01208                 sprintf(binLabel, "ME%d/%d_GlobalPhi", station,ring );
01209                 hprofGlobalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01210                 hprofGlobalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorPhi);
01211                 hprofGlobalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01212             }
01213 
01214             if (nameHistoGlobalTheta.Contains("ME")) // HistoGlobalTheta CSC
01215             {
01216 
01217                 int station, ring, chamber;
01218 
01219                 sscanf(nameHistoGlobalTheta, "ResidualGlobalTheta_ME%dR%1dC%d",&station,&ring,&chamber);
01220 
01221                 Double_t MeanTheta=unitsGlobalTheta[i]->GetMean();
01222                 Double_t ErrorTheta=unitsGlobalTheta[i]->GetMeanError();
01223 
01224                 Int_t xbin=abs(station)*2+ring;
01225                 if(abs(station)==1) xbin=ring;
01226                 if (station>0) xbin=xbin+9;
01227                 else xbin = 10 -xbin;
01228 
01229                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
01230                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
01231                 else if(xbin<6) xbin=108+chamber;
01232                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
01233                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
01234                 else xbin=522+chamber;
01235 
01236                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
01237 
01238                 hprofGlobalThetaCSC->SetMarkerStyle(21);
01239                 hprofGlobalThetaCSC->SetMarkerColor(kRed);
01240                 hprofGlobalThetaCSC->SetBinContent(xbin,MeanTheta);
01241                 hprofGlobalThetaCSC->SetBinError(xbin, ErrorTheta);
01242                 hprofGlobalThetaCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
01243 
01244                 Int_t ybin=abs(station)*2+ring;
01245                 if(abs(station)==1) ybin=ring;
01246                 if (station>0) ybin=ybin+9;
01247                 else ybin = 10 -ybin;
01248                 ybin=2*ybin;
01249                 hprofGlobalAngleCSC->SetBinContent(chamber,ybin,fabs(MeanTheta));
01250                 sprintf(binLabel, "ME%d/%d_GlobalTheta", station,ring );
01251                 hprofGlobalAngleCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01252                 hprofGlobalAngleRmsCSC->SetBinContent(chamber,ybin,ErrorTheta);
01253                 hprofGlobalAngleRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01254             }
01255 
01256             if (nameHistoGlobalRZ.Contains("MB")) // HistoGlobalZ DT
01257             {
01258 
01259                 int wheel, station, sector;
01260 
01261                 sscanf(nameHistoGlobalRZ, "ResidualGlobalZ_W%dMB%1dS%d",&wheel,&station,&sector);
01262         
01263                 if(station!=4){
01264                     Int_t nstation=station - 1;
01265                     Int_t nwheel=wheel+2;
01266 
01267                     Double_t MeanZ=unitsGlobalRZ[i]->GetMean();
01268                     Double_t ErrorZ=unitsGlobalRZ[i]->GetMeanError();
01269 
01270                     Int_t xbin=sector+14*nstation+14*4*nwheel;
01271 
01272                     sprintf(binLabel, "MB%d/%dS%d", wheel, station, sector );
01273 
01274                     hprofGlobalZDT->SetMarkerStyle(21);
01275                     hprofGlobalZDT->SetMarkerColor(kRed);
01276 
01277                     hprofGlobalZDT->SetBinContent(xbin,MeanZ);
01278                     hprofGlobalZDT->SetBinError(xbin, ErrorZ);
01279                     hprofGlobalZDT->GetXaxis()->SetBinLabel(xbin, binLabel);
01280 
01281                     Int_t ybin=2+nwheel*8+nstation*2;
01282                     hprofGlobalPositionDT->SetBinContent(sector,ybin,fabs(MeanZ));
01283                     sprintf(binLabel, "MB%d/%d_GlobalZ", wheel,station );
01284                     hprofGlobalPositionDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01285                     hprofGlobalPositionRmsDT->SetBinContent(sector,ybin,ErrorZ);
01286                     hprofGlobalPositionRmsDT->GetYaxis()->SetBinLabel(ybin,binLabel);
01287                 }
01288             }
01289 
01290             if (nameHistoGlobalRZ.Contains("ME")) // HistoGlobalR CSC
01291             {
01292 
01293                 int station, ring, chamber;
01294 
01295                 sscanf(nameHistoGlobalRZ, "ResidualGlobalR_ME%dR%1dC%d",&station,&ring,&chamber);
01296 
01297                 Double_t MeanR=unitsGlobalRZ[i]->GetMean();
01298                 Double_t ErrorR=unitsGlobalRZ[i]->GetMeanError();
01299 
01300                 Int_t xbin=abs(station)*2+ring;
01301                 if(abs(station)==1) xbin=ring;
01302                 if (station>0) xbin=xbin+9;
01303                 else xbin = 10 -xbin;
01304 
01305                 // To avoid holes in xAxis, I can't imagine right now a simpler way...
01306                 if(xbin<5) xbin= 18*(((Int_t)(xbin/3))*2+(Int_t)(xbin/2))+chamber;
01307                 else if(xbin<6) xbin=108+chamber;
01308                 else if(xbin<14) xbin=126 +(xbin-6)*36+chamber;
01309                 else if(xbin<18) xbin=414+18*(((Int_t)(xbin-13)/3)*2+((Int_t)(xbin-13)/2))+chamber;
01310                 else xbin=522+chamber;
01311 
01312                 sprintf(binLabel, "ME%d/%dC%d", station, ring, chamber );
01313 
01314                 hprofGlobalRCSC->SetMarkerStyle(21);
01315                 hprofGlobalRCSC->SetMarkerColor(kRed);
01316                 hprofGlobalRCSC->SetBinContent(xbin,MeanR);
01317                 hprofGlobalRCSC->SetBinError(xbin, ErrorR);
01318                 hprofGlobalRCSC->GetXaxis()->SetBinLabel(xbin, binLabel);
01319 
01320                 Int_t ybin=abs(station)*2+ring;
01321                 if(abs(station)==1) ybin=ring;
01322                 if (station>0) ybin=ybin+9;
01323                 else ybin = 10 -ybin;
01324                 ybin=2*ybin;
01325                 hprofGlobalPositionCSC->SetBinContent(chamber,ybin,fabs(MeanR));
01326                 sprintf(binLabel, "ME%d/%d_GlobalR", station,ring );
01327                 hprofGlobalPositionCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01328                 hprofGlobalPositionRmsCSC->SetBinContent(chamber,ybin,ErrorR);
01329                 hprofGlobalPositionRmsCSC->GetYaxis()->SetBinLabel(ybin,binLabel);
01330             }
01331 
01332         } // for in histos
01333 
01334     } // doResPlots
01335 
01336 }
01337  
01338 
01339 void MuonAlignmentAnalyzer::analyze(const edm::Event & event, const edm::EventSetup& eventSetup){
01340     
01341     GlobalVector p1,p2;
01342     std::vector< double > simPar[4] ; //pt,eta,phi,charge
01343   
01344 
01345 // ######### if data= MC, do Simulation Plots#####
01346     if(theDataType == "SimData"){
01347         double simEta=0;
01348         double simPt=0;
01349         double simPhi=0;
01350         int i=0, ie=0,ib=0;
01351 
01352         // Get the SimTrack collection from the event
01353         edm::Handle<edm::SimTrackContainer> simTracks;
01354         event.getByLabel("g4SimHits",simTracks);
01355   
01356 
01357           edm::SimTrackContainer::const_iterator simTrack;
01358 
01359         for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
01360             if (abs((*simTrack).type()) == 13) {
01361                 i++;
01362                 simPt=(*simTrack).momentum().Pt();
01363                 simEta=(*simTrack).momentum().eta();
01364                 simPhi=(*simTrack).momentum().phi();
01365                 numberOfSimTracks++;
01366                 hSimPT->Fill(simPt);
01367                 if(fabs(simEta)<1.04) {hSimPT_Barrel->Fill(simPt);ib++;}
01368                 else {hSimPT_Endcap->Fill(simPt);ie++;}
01369                 hSimPTvsEta->Fill(simEta,simPt);
01370                 hSimPTvsPhi->Fill(simPhi,simPt);
01371                 hSimPhivsEta->Fill(simEta,simPhi);
01372 
01373                 simPar[0].push_back(simPt);
01374                 simPar[1].push_back(simEta);
01375                 simPar[2].push_back(simPhi);
01376                 simPar[3].push_back((*simTrack).charge());
01377         
01378 //      Save the muon pair
01379                 if(i==1)  p1=GlobalVector((*simTrack).momentum().x(),(*simTrack).momentum().y(),(*simTrack).momentum().z());
01380                 if(i==2)  p2=GlobalVector((*simTrack).momentum().x(),(*simTrack).momentum().y(),(*simTrack).momentum().z());
01381             }    
01382         }
01383         hSimNmuons->Fill(i);
01384         hSimNmuons_Barrel->Fill(ib);
01385         hSimNmuons_Endcap->Fill(ie);
01386 
01387         if(i>1){ // Take 2 first muons :-(
01388             TLorentzVector mu1(p1.x(), p1.y(), p1.z(), p1.mag());
01389             TLorentzVector mu2(p2.x(), p2.y(), p2.z(), p2.mag());
01390             TLorentzVector pair = mu1 + mu2;
01391             double Minv = pair.M();
01392             hSimInvM->Fill(Minv);
01393             if(fabs(p1.eta())<1.04 && fabs(p2.eta())<1.04) hSimInvM_Barrel->Fill(Minv);
01394             else if(fabs(p1.eta())>=1.04 && fabs(p2.eta())>=1.04) hSimInvM_Endcap->Fill(Minv);
01395             else  hSimInvM_Overlap->Fill(Minv);  
01396         }
01397 
01398     } //simData
01399   
01400   
01401 // ############ Stand Alone Muon plots ###############  
01402     if(doSAplots){
01403 
01404         double SArecPt=0.;
01405         double SAeta=0.;
01406         double SAphi=0.;
01407         int i=0, ie=0,ib=0;
01408         double ich=0;
01409 
01410         // Get the RecTrack collection from the event
01411         edm::Handle<reco::TrackCollection> staTracks;
01412         event.getByLabel(theSTAMuonTag, staTracks);
01413         numberOfSARecTracks += staTracks->size();
01414 
01415         reco::TrackCollection::const_iterator staTrack;
01416 
01417         for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
01418             i++;    
01419     
01420             SArecPt = (*staTrack).pt();
01421             SAeta = (*staTrack).eta();
01422             SAphi = (*staTrack).phi();
01423             ich= (*staTrack).charge();
01424 
01425             hSAPTRec->Fill(SArecPt);
01426             hSAPhivsEta->Fill(SAeta,SAphi);
01427             hSAChi2->Fill((*staTrack).chi2());
01428             hSANhits->Fill((*staTrack).numberOfValidHits());
01429             if(fabs(SAeta)<1.04) {hSAPTRec_Barrel->Fill(SArecPt); hSAChi2_Barrel->Fill((*staTrack).chi2()); hSANhits_Barrel->Fill((*staTrack).numberOfValidHits()); ib++;}
01430             else {hSAPTRec_Endcap->Fill(SArecPt); hSAChi2_Endcap->Fill((*staTrack).chi2()); hSANhits_Endcap->Fill((*staTrack).numberOfValidHits()); ie++;}
01431 
01432 // save the muon pair
01433             if(i==1)  p1=GlobalVector((*staTrack).momentum().x(),(*staTrack).momentum().y(),(*staTrack).momentum().z());
01434             if(i==2)  p2=GlobalVector((*staTrack).momentum().x(),(*staTrack).momentum().y(),(*staTrack).momentum().z());
01435 
01436    
01437             if(SArecPt && theDataType == "SimData"){  
01438 
01439                 double candDeltaR= -999.0, dR;
01440                 int iCand=0;
01441                 if(simPar[0].size()>0){
01442                     for(unsigned int  iSim = 0; iSim <simPar[0].size(); iSim++) {
01443                         dR=deltaR(SAeta,SAphi,simPar[1][iSim],simPar[2][iSim]);
01444                         if(candDeltaR<0 || dR<candDeltaR) {
01445                             candDeltaR=dR;
01446                             iCand=iSim;
01447                         }
01448                     }}
01449         
01450                 double simPt=simPar[0][iCand];
01451                 hSAPTres->Fill( (SArecPt-simPt)/simPt);
01452                 if(fabs(SAeta)<1.04) hSAPTres_Barrel->Fill((SArecPt-simPt)/simPt);
01453                 else hSAPTres_Endcap->Fill((SArecPt-simPt)/simPt);
01454 
01455                 hSAPTDiff->Fill(SArecPt-simPt);
01456 
01457                 hSAPTDiffvsEta->Fill(SAeta,SArecPt-simPt);
01458                 hSAPTDiffvsPhi->Fill(SAphi,SArecPt-simPt);
01459                 double ptInvRes= ( ich/SArecPt - simPar[3][iCand]/simPt)/ (simPar[3][iCand]/simPt);
01460                 hSAinvPTres->Fill( ptInvRes);
01461 
01462                 hSAinvPTvsEta->Fill(SAeta,ptInvRes);
01463                 hSAinvPTvsPhi->Fill(SAphi,ptInvRes);
01464                 hSAinvPTvsNhits->Fill((*staTrack).numberOfValidHits(),ptInvRes);
01465             }
01466 
01467             hSAPTvsEta->Fill(SAeta,SArecPt);
01468             hSAPTvsPhi->Fill(SAphi,SArecPt);
01469         }
01470 
01471         hSANmuons->Fill(i);
01472         hSANmuons_Barrel->Fill(ib);
01473         hSANmuons_Endcap->Fill(ie);
01474 
01475         if(i>1){ // Take 2 first muons :-(
01476             TLorentzVector mu1(p1.x(), p1.y(), p1.z(), p1.mag());
01477             TLorentzVector mu2(p2.x(), p2.y(), p2.z(), p2.mag());
01478             TLorentzVector pair = mu1 + mu2;
01479             double Minv = pair.M();
01480             hSAInvM->Fill(Minv);
01481             if(fabs(p1.eta())<1.04 && fabs(p2.eta())<1.04) hSAInvM_Barrel->Fill(Minv);
01482             else if(fabs(p1.eta())>=1.04 && fabs(p2.eta())>=1.04) hSAInvM_Endcap->Fill(Minv);
01483             else hSAInvM_Overlap->Fill(Minv);
01484         } // 2 first muons
01485 
01486     }//end doSAplots
01487 
01488 
01489 
01490 // ############### Global Muons plots ##########
01491 
01492     if(doGBplots){  
01493         // Get the RecTrack collection from the event
01494         edm::Handle<reco::TrackCollection> glbTracks;
01495         event.getByLabel(theGLBMuonTag, glbTracks);
01496         numberOfGBRecTracks += glbTracks->size();
01497 
01498         double GBrecPt = 0; 
01499         double GBeta = 0;
01500         double GBphi = 0;
01501         double ich =0;
01502         int i=0, ie=0,ib=0;
01503 
01504         reco::TrackCollection::const_iterator glbTrack;
01505 
01506         for (glbTrack = glbTracks->begin(); glbTrack != glbTracks->end(); ++glbTrack){
01507             i++;
01508 
01509             GBrecPt = (*glbTrack).pt(); 
01510             GBeta = (*glbTrack).eta();
01511             GBphi = (*glbTrack).phi();
01512             ich=   (*glbTrack).charge();
01513     
01514             hGBPTRec->Fill(GBrecPt);
01515             hGBPhivsEta->Fill(GBeta,GBphi);
01516             hGBChi2->Fill((*glbTrack).chi2());
01517             hGBNhits->Fill((*glbTrack).numberOfValidHits());
01518             if(fabs(GBeta)<1.04) {hGBPTRec_Barrel->Fill(GBrecPt); hGBChi2_Barrel->Fill((*glbTrack).chi2()); hGBNhits_Barrel->Fill((*glbTrack).numberOfValidHits()); ib++;}
01519             else {hGBPTRec_Endcap->Fill(GBrecPt); hGBChi2_Endcap->Fill((*glbTrack).chi2()); hGBNhits_Endcap->Fill((*glbTrack).numberOfValidHits()); ie++;}
01520   
01521 // save the muon pair
01522             if(i==1)  p1=GlobalVector((*glbTrack).momentum().x(),(*glbTrack).momentum().y(),(*glbTrack).momentum().z());
01523             if(i==2)  p2=GlobalVector((*glbTrack).momentum().x(),(*glbTrack).momentum().y(),(*glbTrack).momentum().z());
01524 
01525             if(GBrecPt && theDataType == "SimData"){ 
01526                 double candDeltaR= -999.0, dR;
01527                 int iCand=0;
01528                 if(simPar[0].size()>0){
01529                     for(unsigned int  iSim = 0; iSim <simPar[0].size(); iSim++) {
01530                         dR=deltaR(GBeta,GBphi,simPar[1][iSim],simPar[2][iSim]);
01531                         if(candDeltaR<0 || dR<candDeltaR) {
01532                             candDeltaR=dR;
01533                             iCand=iSim;
01534                         }
01535                     }}
01536 
01537                 double simPt=simPar[0][iCand];
01538         
01539                 hGBPTres->Fill( (GBrecPt-simPt)/simPt);
01540                 if(fabs(GBeta)<1.04) hGBPTres_Barrel->Fill((GBrecPt-simPt)/simPt);
01541                 else hGBPTres_Endcap->Fill((GBrecPt-simPt)/simPt);
01542 
01543                 hGBPTDiff->Fill(GBrecPt-simPt);
01544 
01545                 hGBPTDiffvsEta->Fill(GBeta,GBrecPt-simPt);
01546                 hGBPTDiffvsPhi->Fill(GBphi,GBrecPt-simPt);
01547 
01548                 double ptInvRes= ( ich/GBrecPt - simPar[3][iCand]/simPt)/ (simPar[3][iCand]/simPt);
01549                 hGBinvPTres->Fill( ptInvRes);
01550 
01551                 hGBinvPTvsEta->Fill(GBeta,ptInvRes);
01552                 hGBinvPTvsPhi->Fill(GBphi,ptInvRes);
01553                 hGBinvPTvsNhits->Fill((*glbTrack).numberOfValidHits(),ptInvRes);
01554             } 
01555 
01556 
01557             hGBPTvsEta->Fill(GBeta,GBrecPt);
01558             hGBPTvsPhi->Fill(GBphi,GBrecPt);
01559 
01560         }
01561 
01562         hGBNmuons->Fill(i);
01563         hGBNmuons_Barrel->Fill(ib);
01564         hGBNmuons_Endcap->Fill(ie);
01565 
01566         if(i>1){ // Take 2 first muons :-(
01567             TLorentzVector mu1(p1.x(), p1.y(), p1.z(), p1.mag());
01568             TLorentzVector mu2(p2.x(), p2.y(), p2.z(), p2.mag());
01569             TLorentzVector pair = mu1 + mu2;
01570             double Minv = pair.M();
01571             hGBInvM->Fill(Minv);
01572             if(fabs(p1.eta())<1.04 && fabs(p2.eta())<1.04)   hGBInvM_Barrel->Fill(Minv);
01573             else if(fabs(p1.eta())>=1.04 && fabs(p2.eta())>=1.04) hGBInvM_Endcap->Fill(Minv);
01574             else hGBInvM_Overlap->Fill(Minv);
01575         }
01576 
01577     } //end doGBplots
01578 
01579 
01580 // ############    Residual plots ###################
01581 
01582     if(doResplots){
01583 
01584         edm::ESHandle<MagneticField> theMGField;
01585         eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
01586 
01587         edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
01588         eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
01589 
01590 
01591         // Get the RecTrack collection from the event
01592         edm::Handle<reco::TrackCollection> staTracks;
01593         event.getByLabel(theSTAMuonTag, staTracks);
01594 
01595         // Get the 4D DTSegments
01596         edm::Handle<DTRecSegment4DCollection> all4DSegmentsDT;
01597         event.getByLabel(theRecHits4DTagDT, all4DSegmentsDT);
01598         DTRecSegment4DCollection::const_iterator segmentDT;
01599 
01600         // Get the 4D CSCSegments
01601         edm::Handle<CSCSegmentCollection> all4DSegmentsCSC;
01602         event.getByLabel(theRecHits4DTagCSC, all4DSegmentsCSC);
01603         CSCSegmentCollection::const_iterator segmentCSC;
01604   
01605         //Vectors used to perform the matching between Segments and hits from Track
01606         intDVector indexCollectionDT;
01607         intDVector indexCollectionCSC;
01608 
01609 /*    std::cout << "<MuonAlignmentAnalyzer> List of DTSegments found in Local Reconstruction" << std::endl;
01610       std::cout << "Number: " << all4DSegmentsDT->size() << std::endl;
01611       for (segmentDT = all4DSegmentsDT->begin(); segmentDT != all4DSegmentsDT->end(); ++segmentDT){
01612       const GeomDet* geomDet = theTrackingGeometry->idToDet((*segmentDT).geographicalId());
01613       std::cout << "<MuonAlignmentAnalyzer> " << geomDet->toGlobal((*segmentDT).localPosition()) << std::endl;
01614       std::cout << "<MuonAlignmentAnalyzer> Local " << (*segmentDT).localPosition() << std::endl;
01615       }
01616       std::cout << "<MuonAlignmentAnalyzer> List of CSCSegments found in Local Reconstruction" << std::endl;
01617       for (segmentCSC = all4DSegmentsCSC->begin(); segmentCSC != all4DSegmentsCSC->end(); ++segmentCSC){
01618       const GeomDet* geomDet = theTrackingGeometry->idToDet((*segmentCSC).geographicalId());
01619       std::cout << "<MuonAlignmentAnalyzer>" << geomDet->toGlobal((*segmentCSC).localPosition()) << std::endl;
01620       }
01621 */   
01622         thePropagator = new SteppingHelixPropagator(&*theMGField, alongMomentum);
01623 
01624         reco::TrackCollection::const_iterator staTrack;
01625         for (staTrack = staTracks->begin(); staTrack != staTracks->end(); ++staTrack){
01626 
01627             int countPoints   = 0;
01628 
01629             reco::TransientTrack track(*staTrack,&*theMGField,theTrackingGeometry); 
01630     
01631 
01632             if(staTrack->numberOfValidHits()>(min1DTrackRecHitSize-1)) {
01633 
01634                 RecHitVector  my4DTrack = this->doMatching(*staTrack, all4DSegmentsDT, all4DSegmentsCSC, &indexCollectionDT, &indexCollectionCSC, theTrackingGeometry);
01635   
01636     
01637 //cut in number of segments
01638 
01639                 if(my4DTrack.size()>(min4DTrackSegmentSize-1) ){
01640 
01641 // start propagation
01642 //    TrajectoryStateOnSurface innerTSOS = track.impactPointState();
01643                     TrajectoryStateOnSurface innerTSOS = track.innermostMeasurementState();
01644 
01645                     //If the state is valid
01646                     if(innerTSOS.isValid()) {
01647 
01648                         //Loop over Associated segments
01649                         for(RecHitVector::iterator rechit = my4DTrack.begin(); rechit != my4DTrack.end(); ++rechit) {
01650         
01651                             const GeomDet* geomDet = theTrackingGeometry->idToDet((*rechit)->geographicalId());
01652 //Otherwise the propagator could throw an exception
01653                             const Plane* pDest = dynamic_cast<const Plane*>(&geomDet->surface());
01654                             const Cylinder* cDest = dynamic_cast<const Cylinder*>(&geomDet->surface());
01655 
01656                             if(pDest != 0 || cDest != 0) {   //Donde antes iba el try
01657  
01658                                 TrajectoryStateOnSurface destiny = thePropagator->propagate(*(innerTSOS.freeState()), geomDet->surface());
01659 
01660                                 if(!destiny.isValid()|| !destiny.hasError()) continue;
01661 
01662 /*          std::cout << "<MuonAlignmentAnalyzer> Segment: " << geomDet->toGlobal((*rechit)->localPosition()) << std::endl;
01663   std::cout << "<MuonAlignmentAnalyzer> Segment local: " << (*rechit)->localPosition() << std::endl;
01664   std::cout << "<MuonAlignmentAnalyzer> Predicted: " << destiny.freeState()->position() << std::endl;
01665   std::cout << "<MuonAlignmentAnalyzer> Predicted local: " << destiny.localPosition() << std::endl;
01666 */
01667                                 const long rawId= (*rechit)->geographicalId().rawId();
01668                                 int position = -1;
01669                                 bool newDetector = true; 
01670                                 //Loop over the DetectorCollection to see if the detector is new and requires a new entry
01671                                 for(std::vector<long>::iterator myIds = detectorCollection.begin(); myIds != detectorCollection.end(); myIds++) {
01672                                     ++position;
01673                                     //If matches newDetector = false
01674                                     if(*myIds == rawId) {
01675                                         newDetector = false;
01676                                         break;
01677                                     }
01678                                 }
01679 
01680                                 DetId myDet(rawId);
01681                                 int det = myDet.subdetId();
01682                                 int wheel=0,station=0,sector=0;
01683                                 int endcap=0,ring=0,chamber=0;
01684 
01685                                 double residualGlobalRPhi=0,residualGlobalPhi=0,residualGlobalR=0,residualGlobalTheta=0,residualGlobalZ=0;
01686                                 double residualLocalX=0,residualLocalPhi=0,residualLocalY=0,residualLocalTheta=0;
01687 
01688                                 // Fill generic histograms
01689                                 //If it's a DT
01690                                 if(det == 1) {
01691                                     DTChamberId myChamber(rawId);
01692                                     wheel=myChamber.wheel();
01693                                     station = myChamber.station();
01694                                     sector=myChamber.sector();
01695               
01696 //global                
01697                                     residualGlobalRPhi = geomDet->toGlobal((*rechit)->localPosition()).perp() * geomDet->toGlobal((*rechit)->localPosition()).barePhi() -       destiny.freeState()->position().perp() * destiny.freeState()->position().barePhi();
01698 
01699 //local
01700                                     residualLocalX = (*rechit)->localPosition().x() -destiny.localPosition().x();
01701                 
01702 //global                
01703                                     residualGlobalPhi = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).barePhi() - destiny.globalDirection().barePhi();
01704 
01705 //local
01706                                     residualLocalPhi = atan2(((RecSegment *)(*rechit))->localDirection().z(), 
01707                                                              ((RecSegment*)(*rechit))->localDirection().x()) - atan2(destiny.localDirection().z(), destiny.localDirection().x());
01708 
01709                                     hResidualGlobalRPhiDT->Fill(residualGlobalRPhi);
01710                                     hResidualGlobalPhiDT->Fill(residualGlobalPhi);
01711                                     hResidualLocalXDT->Fill(residualLocalX);
01712                                     hResidualLocalPhiDT->Fill(residualLocalPhi);
01713 
01714                                     if(station!=4){
01715 //global                
01716                                         residualGlobalZ = geomDet->toGlobal((*rechit)->localPosition()).z() - destiny.freeState()->position().z();
01717                 
01718 //local
01719                                         residualLocalY = (*rechit)->localPosition().y() - destiny.localPosition().y();
01720                 
01721 //global                
01722                                         residualGlobalTheta = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).bareTheta() - destiny.globalDirection().bareTheta();
01723 
01724 //local
01725                                         residualLocalTheta = atan2(((RecSegment *)(*rechit))->localDirection().z(), 
01726                                                                    ((RecSegment*)(*rechit))->localDirection().y()) - atan2(destiny.localDirection().z(), destiny.localDirection().y());
01727 
01728                 
01729                                         hResidualGlobalThetaDT->Fill(residualGlobalTheta);
01730                                         hResidualGlobalZDT->Fill(residualGlobalZ);
01731                                         hResidualLocalThetaDT->Fill(residualLocalTheta);
01732                                         hResidualLocalYDT->Fill(residualLocalY);
01733                                     }
01734 
01735                                     int index = wheel+2;
01736                                     hResidualGlobalRPhiDT_W[index]->Fill(residualGlobalRPhi);
01737                                     hResidualGlobalPhiDT_W[index]->Fill(residualGlobalPhi);
01738                                     hResidualLocalXDT_W[index]->Fill(residualLocalX);
01739                                     hResidualLocalPhiDT_W[index]->Fill(residualLocalPhi);
01740                                     if(station!=4){
01741                                         hResidualGlobalThetaDT_W[index]->Fill(residualGlobalTheta);
01742                                         hResidualGlobalZDT_W[index]->Fill(residualGlobalZ);
01743                                         hResidualLocalThetaDT_W[index]->Fill(residualLocalTheta);
01744                                         hResidualLocalYDT_W[index]->Fill(residualLocalY);
01745                                     }
01746                 
01747                                     index=wheel*4+station+7;
01748                                     hResidualGlobalRPhiDT_MB[index]->Fill(residualGlobalRPhi);
01749                                     hResidualGlobalPhiDT_MB[index]->Fill(residualGlobalPhi);
01750                                     hResidualLocalXDT_MB[index]->Fill(residualLocalX);
01751                                     hResidualLocalPhiDT_MB[index]->Fill(residualLocalPhi);
01752 
01753                                     if(station!=4){               
01754                                         hResidualGlobalThetaDT_MB[index]->Fill(residualGlobalTheta);
01755                                         hResidualGlobalZDT_MB[index]->Fill(residualGlobalZ);
01756                                         hResidualLocalThetaDT_MB[index]->Fill(residualLocalTheta);
01757                                         hResidualLocalYDT_MB[index]->Fill(residualLocalY);
01758                                     }
01759                                 } 
01760                                 else if (det==2){
01761                                     CSCDetId myChamber(rawId);
01762                                     endcap= myChamber.endcap();
01763                                     station = myChamber.station();
01764                                     if(endcap==2) station = -station;
01765                                     ring = myChamber.ring();
01766                                     chamber=myChamber.chamber();
01767 
01768 
01769 //global                
01770                                     residualGlobalRPhi = geomDet->toGlobal((*rechit)->localPosition()).perp() * geomDet->toGlobal((*rechit)->localPosition()).barePhi() -       destiny.freeState()->position().perp() * destiny.freeState()->position().barePhi();
01771 
01772 //local
01773                                     residualLocalX = (*rechit)->localPosition().x() -destiny.localPosition().x();
01774                 
01775 //global                
01776                                     residualGlobalR = geomDet->toGlobal((*rechit)->localPosition()).perp() - destiny.freeState()->position().perp();
01777                 
01778 //local
01779                                     residualLocalY = (*rechit)->localPosition().y() - destiny.localPosition().y();
01780                 
01781 //global                
01782                                     residualGlobalPhi = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).barePhi() - destiny.globalDirection().barePhi();
01783 
01784 //local
01785                                     residualLocalPhi = atan2(((RecSegment *)(*rechit))->localDirection().y(), 
01786                                                              ((RecSegment*)(*rechit))->localDirection().x()) - atan2(destiny.localDirection().y(), destiny.localDirection().x());
01787 
01788 //global                
01789                                     residualGlobalTheta = geomDet->toGlobal(((RecSegment *)(*rechit))->localDirection()).bareTheta() - destiny.globalDirection().bareTheta();
01790 
01791 //local
01792                                     residualLocalTheta = atan2(((RecSegment *)(*rechit))->localDirection().y(), 
01793                                                                ((RecSegment*)(*rechit))->localDirection().z()) - atan2(destiny.localDirection().y(), destiny.localDirection().z());
01794 
01795                                     hResidualGlobalRPhiCSC->Fill(residualGlobalRPhi);
01796                                     hResidualGlobalPhiCSC->Fill(residualGlobalPhi);
01797                                     hResidualGlobalThetaCSC->Fill(residualGlobalTheta);
01798                                     hResidualGlobalRCSC->Fill(residualGlobalR);
01799                                     hResidualLocalXCSC->Fill(residualLocalX);
01800                                     hResidualLocalPhiCSC->Fill(residualLocalPhi);
01801                                     hResidualLocalThetaCSC->Fill(residualLocalTheta);
01802                                     hResidualLocalYCSC->Fill(residualLocalY);
01803 
01804                                     int index=2*station+ring+7;
01805                                     if(station==-1) {index=5+ring;
01806                                         if(ring==4) index=6;}
01807                                     if(station==1) {index=8+ring;
01808                                         if(ring==4) index=9;}
01809                                     hResidualGlobalRPhiCSC_ME[index]->Fill(residualGlobalRPhi);
01810                                     hResidualGlobalPhiCSC_ME[index]->Fill(residualGlobalPhi);
01811                                     hResidualGlobalThetaCSC_ME[index]->Fill(residualGlobalTheta);
01812                                     hResidualGlobalRCSC_ME[index]->Fill(residualGlobalR);
01813                                     hResidualLocalXCSC_ME[index]->Fill(residualLocalX);
01814                                     hResidualLocalPhiCSC_ME[index]->Fill(residualLocalPhi);
01815                                     hResidualLocalThetaCSC_ME[index]->Fill(residualLocalTheta);
01816                                     hResidualLocalYCSC_ME[index]->Fill(residualLocalY);
01817 
01818                                 }
01819                                 else{residualGlobalRPhi=0,residualGlobalPhi=0,residualGlobalR=0,residualGlobalTheta=0,residualGlobalZ=0;
01820                                     residualLocalX=0,residualLocalPhi=0,residualLocalY=0,residualLocalTheta=0,residualLocalY=0;
01821                                 }
01822 // Fill individual chamber histograms
01823                                 if(newDetector) {
01824             
01825                                     //Create an RawIdDetector, fill it and push it into the collection 
01826                                     detectorCollection.push_back(rawId);
01827 
01828                                     //This piece of code calculates the range of the residuals
01829                                     double rangeX = 3.0, rangeY =5.;
01830                                     switch(abs(station)) {
01831                                         case 1:
01832                                         {rangeX = resLocalXRangeStation1; rangeY = resLocalYRangeStation1;}
01833                                         break;
01834                                         case 2:
01835                                         {rangeX = resLocalXRangeStation2; rangeY = resLocalYRangeStation2;}
01836                                         break;
01837                                         case 3:
01838                                         {rangeX = resLocalXRangeStation3; rangeY = resLocalYRangeStation3;}
01839                                         break;
01840                                         case 4:
01841                                         {rangeX = resLocalXRangeStation4; rangeY = resLocalYRangeStation4;}
01842                                         break;
01843                                         default:
01844                                             break;
01845                                     }
01846 
01847                                     //create new histograms
01848 
01849                                     char nameOfHistoLocalX[50];
01850                                     char nameOfHistoLocalTheta[50];
01851                                     char nameOfHistoLocalY[50];
01852                                     char nameOfHistoLocalPhi[50];
01853                                     char nameOfHistoGlobalRPhi[50];
01854                                     char nameOfHistoGlobalTheta[50];
01855                                     char nameOfHistoGlobalR[50];
01856                                     char nameOfHistoGlobalPhi[50];
01857                                     char nameOfHistoGlobalZ[50];
01858         
01859                                     if(det==1){ // DT
01860                                         sprintf(nameOfHistoLocalX, "ResidualLocalX_W%dMB%1dS%1d",wheel,station,sector );
01861                                         sprintf(nameOfHistoLocalPhi, "ResidualLocalPhi_W%dMB%1dS%1d",wheel,station,sector);
01862                                         sprintf(nameOfHistoGlobalRPhi, "ResidualGlobalRPhi_W%dMB%1dS%1d",wheel,station,sector );
01863                                         sprintf(nameOfHistoGlobalPhi, "ResidualGlobalPhi_W%dMB%1dS%1d",wheel,station,sector);
01864                                         sprintf(nameOfHistoLocalTheta, "ResidualLocalTheta_W%dMB%1dS%1d",wheel,station,sector);
01865                                         sprintf(nameOfHistoLocalY, "ResidualLocalY_W%dMB%1dS%1d",wheel,station,sector);
01866                                         TH1F *histoLocalY = fs->make<TH1F>(nameOfHistoLocalY, nameOfHistoLocalY, nbins, -rangeY, rangeY);
01867                                         unitsLocalY.push_back(histoLocalY);
01868                                         sprintf(nameOfHistoGlobalTheta, "ResidualGlobalTheta_W%dMB%1dS%1d",wheel,station,sector);
01869                                         sprintf(nameOfHistoGlobalZ, "ResidualGlobalZ_W%dMB%1dS%1d",wheel,station,sector);
01870                                         TH1F *histoGlobalZ = fs->make<TH1F>(nameOfHistoGlobalZ, nameOfHistoGlobalZ, nbins, -rangeY, rangeY);
01871                                         unitsGlobalRZ.push_back(histoGlobalZ);
01872 
01873                                     }
01874                                     else if(det==2){ //CSC
01875                                         sprintf(nameOfHistoLocalX, "ResidualLocalX_ME%dR%1dC%1d",station,ring,chamber );
01876                                         sprintf(nameOfHistoLocalPhi, "ResidualLocalPhi_ME%dR%1dC%1d",station,ring,chamber);
01877                                         sprintf(nameOfHistoLocalTheta, "ResidualLocalTheta_ME%dR%1dC%1d",station,ring,chamber);
01878                                         sprintf(nameOfHistoLocalY, "ResidualLocalY_ME%dR%1dC%1d",station,ring,chamber);
01879                                         TH1F *histoLocalY = fs->make<TH1F>(nameOfHistoLocalY, nameOfHistoLocalY, nbins, -rangeY, rangeY);
01880                                         unitsLocalY.push_back(histoLocalY);
01881                                         sprintf(nameOfHistoGlobalRPhi, "ResidualGlobalRPhi_ME%dR%1dC%1d",station,ring,chamber );
01882                                         sprintf(nameOfHistoGlobalPhi, "ResidualGlobalPhi_ME%dR%1dC%1d",station,ring,chamber);
01883                                         sprintf(nameOfHistoGlobalTheta, "ResidualGlobalTheta_ME%dR%1dC%1d",station,ring,chamber);
01884                                         sprintf(nameOfHistoGlobalR, "ResidualGlobalR_ME%dR%1dC%1d",station,ring,chamber);
01885                                         TH1F *histoGlobalR = fs->make<TH1F>(nameOfHistoGlobalR, nameOfHistoGlobalR, nbins, -rangeY, rangeY);
01886                                         unitsGlobalRZ.push_back(histoGlobalR);
01887                                     }               
01888             
01889                                     // Common histos to DT and CSC
01890                                     TH1F *histoLocalX = fs->make<TH1F>(nameOfHistoLocalX, nameOfHistoLocalX, nbins, -rangeX, rangeX);
01891                                     TH1F *histoGlobalRPhi = fs->make<TH1F>(nameOfHistoGlobalRPhi, nameOfHistoGlobalRPhi, nbins, -rangeX, rangeX);
01892                                     TH1F *histoLocalPhi = fs->make<TH1F>(nameOfHistoLocalPhi, nameOfHistoLocalPhi, nbins, -resPhiRange, resPhiRange);
01893                                     TH1F *histoGlobalPhi = fs->make<TH1F>(nameOfHistoGlobalPhi, nameOfHistoGlobalPhi, nbins, -resPhiRange, resPhiRange);
01894                                     TH1F *histoGlobalTheta = fs->make<TH1F>(nameOfHistoGlobalTheta, nameOfHistoGlobalTheta, nbins, -resThetaRange, resThetaRange);
01895                                     TH1F *histoLocalTheta = fs->make<TH1F>(nameOfHistoLocalTheta, nameOfHistoLocalTheta, nbins, -resThetaRange, resThetaRange);
01896 
01897                                     histoLocalX->Fill(residualLocalX);
01898                                     histoLocalPhi->Fill(residualLocalPhi);
01899                                     histoLocalTheta->Fill(residualLocalTheta);  
01900                                     histoGlobalRPhi->Fill(residualGlobalRPhi);
01901                                     histoGlobalPhi->Fill(residualGlobalPhi);
01902                                     histoGlobalTheta->Fill(residualGlobalTheta);        
01903                                     //Push them into their respective vectors
01904                                     unitsLocalX.push_back(histoLocalX);
01905                                     unitsLocalPhi.push_back(histoLocalPhi);
01906                                     unitsLocalTheta.push_back(histoLocalTheta);
01907                                     unitsGlobalRPhi.push_back(histoGlobalRPhi);
01908                                     unitsGlobalPhi.push_back(histoGlobalPhi);
01909                                     unitsGlobalTheta.push_back(histoGlobalTheta);
01910 
01911                                 } // new detector
01912                                 else {
01913                                     //If the detector was not new, just fill the histogram
01914                                     unitsLocalX.at(position)->Fill(residualLocalX);
01915                                     unitsLocalPhi.at(position)->Fill(residualLocalPhi);
01916                                     unitsLocalTheta.at(position)->Fill(residualLocalTheta);
01917                                     unitsGlobalRPhi.at(position)->Fill(residualGlobalRPhi);
01918                                     unitsGlobalPhi.at(position)->Fill(residualGlobalPhi);
01919                                     unitsGlobalTheta.at(position)->Fill(residualGlobalTheta);
01920                                     if(det==1) {unitsLocalY.at(position)->Fill(residualLocalY); unitsGlobalRZ.at(position)->Fill(residualGlobalZ);}
01921                                     else if(det==2) {unitsLocalY.at(position)->Fill(residualLocalY); unitsGlobalRZ.at(position)->Fill(residualGlobalR);}                
01922                                 }
01923            
01924                                 countPoints++;
01925         
01926                                 innerTSOS = destiny;
01927 
01928 
01929                             }else {
01930                                 edm::LogError("MuonAlignmentAnalyzer") <<" Error!! Exception in propagator catched" << std::endl;
01931                                 continue;
01932                             }
01933 
01934                         } //loop over my4DTrack
01935                     } //TSOS was valid
01936 
01937                 } // cut in at least 4 segments
01938 
01939             } //end cut in RecHitsSize>36
01940             numberOfHits=numberOfHits+countPoints;
01941         } //loop over STAtracks
01942 
01943         delete thePropagator;
01944 
01945     } //end doResplots
01946  
01947 
01948 }
01949 
01950 RecHitVector MuonAlignmentAnalyzer::doMatching(const reco::Track &staTrack, edm::Handle<DTRecSegment4DCollection> &all4DSegmentsDT, edm::Handle<CSCSegmentCollection> &all4DSegmentsCSC, intDVector *indexCollectionDT, intDVector *indexCollectionCSC, edm::ESHandle<GlobalTrackingGeometry> &theTrackingGeometry) {
01951 
01952     DTRecSegment4DCollection::const_iterator segmentDT;
01953     CSCSegmentCollection::const_iterator segmentCSC;
01954   
01955     std::vector<int> positionDT;
01956     std::vector<int> positionCSC;
01957     RecHitVector my4DTrack;
01958   
01959     //Loop over the hits of the track
01960     for( int counter = 0; counter != staTrack.numberOfValidHits()-1; counter++) {
01961     
01962         TrackingRecHitRef myRef = staTrack.recHit(counter);
01963         const TrackingRecHit *rechit = myRef.get();
01964         const GeomDet* geomDet = theTrackingGeometry->idToDet(rechit->geographicalId());
01965     
01966         //It's a DT Hit
01967         if(geomDet->subDetector() == GeomDetEnumerators::DT) {
01968       
01969             //Take the layer associated to this hit
01970             DTLayerId myLayer(rechit->geographicalId().rawId());
01971       
01972             int NumberOfDTSegment = 0;
01973             //Loop over segments
01974             for(segmentDT = all4DSegmentsDT->begin(); segmentDT != all4DSegmentsDT->end(); ++segmentDT) {
01975         
01976                 //By default the chamber associated to this Segment is new
01977                 bool isNewChamber = true;
01978         
01979                 //Loop over segments already included in the vector of segments in the actual track
01980                 for(std::vector<int>::iterator positionIt = positionDT.begin(); positionIt != positionDT.end(); positionIt++) {
01981           
01982                     //If this segment has been used before isNewChamber = false
01983                     if(NumberOfDTSegment == *positionIt) isNewChamber = false;
01984                 }
01985         
01986                 //Loop over vectors of segments associated to previous tracks
01987                 for(std::vector<std::vector<int> >::iterator collect = indexCollectionDT->begin(); collect != indexCollectionDT->end(); ++collect) {
01988           
01989                     //Loop over segments associated to a track
01990                     for(std::vector<int>::iterator positionIt = (*collect).begin(); positionIt != (*collect).end(); positionIt++) {
01991             
01992                         //If this segment was used in a previos track then isNewChamber = false
01993                         if(NumberOfDTSegment == *positionIt) isNewChamber = false;
01994                     }
01995                 }
01996         
01997                 //If the chamber is new
01998                 if(isNewChamber) {
01999           
02000                     DTChamberId myChamber((*segmentDT).geographicalId().rawId());
02001                     //If the layer of the hit belongs to the chamber of the 4D Segment
02002                     if(myLayer.wheel() == myChamber.wheel() && myLayer.station() == myChamber.station() && myLayer.sector() == myChamber.sector()) {
02003             
02004                         //push position of the segment and tracking rechit
02005                         positionDT.push_back(NumberOfDTSegment);
02006                         my4DTrack.push_back((TrackingRecHit *) &(*segmentDT));
02007                     }
02008                 }
02009                 NumberOfDTSegment++;
02010             }
02011             //In case is a CSC
02012         } else if (geomDet->subDetector() == GeomDetEnumerators::CSC) {
02013       
02014             //Take the layer associated to this hit
02015             CSCDetId myLayer(rechit->geographicalId().rawId());
02016       
02017             int NumberOfCSCSegment = 0;
02018             //Loop over 4Dsegments
02019             for(segmentCSC = all4DSegmentsCSC->begin(); segmentCSC != all4DSegmentsCSC->end(); segmentCSC++) {
02020         
02021                 //By default the chamber associated to the segment is new
02022                 bool isNewChamber = true;
02023         
02024                 //Loop over segments in the current track
02025                 for(std::vector<int>::iterator positionIt = positionCSC.begin(); positionIt != positionCSC.end(); positionIt++) {
02026           
02027                     //If this segment has been used then newchamber = false
02028                     if(NumberOfCSCSegment == *positionIt) isNewChamber = false;
02029                 }
02030                 //Loop over vectors of segments in previous tracks
02031                 for(std::vector<std::vector<int> >::iterator collect = indexCollectionCSC->begin(); collect != indexCollectionCSC->end(); ++collect) {
02032           
02033                     //Loop over segments in a track
02034                     for(std::vector<int>::iterator positionIt = (*collect).begin(); positionIt != (*collect).end(); positionIt++) {
02035             
02036                         //If the segment was used in a previous track isNewChamber = false
02037                         if(NumberOfCSCSegment == *positionIt) isNewChamber = false;
02038                     }
02039                 }
02040                 //If the chamber is new
02041                 if(isNewChamber) {
02042           
02043                     CSCDetId myChamber((*segmentCSC).geographicalId().rawId());
02044                     //If the chambers are the same
02045                     if(myLayer.chamberId() == myChamber.chamberId()) {
02046                         //push
02047                         positionCSC.push_back(NumberOfCSCSegment);
02048                         my4DTrack.push_back((TrackingRecHit *) &(*segmentCSC));
02049                     }
02050                 }
02051                 NumberOfCSCSegment++;
02052             }
02053         }
02054     }
02055   
02056     indexCollectionDT->push_back(positionDT);
02057     indexCollectionCSC->push_back(positionCSC);
02058   
02059     return my4DTrack;
02060 }
02061 
02062 DEFINE_FWK_MODULE(MuonAlignmentAnalyzer);