CMS 3D CMS Logo

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