CMS 3D CMS Logo

HistoMuon.cc

Go to the documentation of this file.
00001 #include "PhysicsTools/StarterKit/interface/HistoMuon.h"
00002 //#include "DataFormats/MuonReco/interface/MuonEnergy.h"
00003 
00004 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
00005 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00006 #include "DataFormats/SiStripDetId/interface/SiStripDetId.h"
00007 
00008 
00009 
00010 #include <iostream>
00011 #include <sstream>
00012 
00013 using pat::HistoMuon;
00014 using namespace std;
00015 
00016 // Constructor:
00017 
00018 
00019 HistoMuon::HistoMuon(std::string dir, std::string group,std::string pre,
00020                    double pt1, double pt2, double m1, double m2,
00021                      TFileDirectory * parentDir)
00022   : HistoGroup<Muon>( dir, group, pre, pt1, pt2, m1, m2, parentDir)
00023 {
00024   addHisto( h_trackIso_ =
00025             new PhysVarHisto( pre + "TrackIso", "Muon Track Isolation", 20, 0, 10, currDir_, "", "vD" )
00026            );
00027 
00028   addHisto( h_caloIso_  =
00029             new PhysVarHisto( pre + "CaloIso",  "Muon Calo Isolation",  20, 0, 10, currDir_, "", "vD" )
00030             );
00031 
00032   addHisto( h_leptonID_ =
00033             new PhysVarHisto( pre + "LeptonID", "Muon Lepton ID",       20, 0, 1, currDir_, "", "vD" )
00034             );
00035 
00036   addHisto( h_calCompat_ =
00037             new PhysVarHisto( pre + "CaloCompat", "Muon Calorimetry Compatability", 100, 0, 1, currDir_, "", "vD" )
00038             );
00039 
00040   addHisto( h_nChambers_ =
00041             new PhysVarHisto( pre + "NChamber", "Muon # of Chambers", 51, -0.5, 50.5, currDir_, "", "vD" )
00042             );
00043 
00044   addHisto( h_caloE_ =
00045             new PhysVarHisto( pre + "CaloE", "Muon Calorimeter Energy", 50, 0, 50, currDir_, "", "vD" )
00046             );
00047   addHisto( h_type_ =
00048             new PhysVarHisto( pre + "Type", "Muon Type", 65, -0.5, 64.5, currDir_, "", "vD" )
00049             );
00050 
00051 
00052   std::string histname = "ecalDepositedEnergy";
00053   addHisto( ecalDepEnergy_ =
00054             new PhysVarHisto( pre + histname, histname, 50, 0., 20., currDir_, "", "vD" )
00055             );
00056 
00057   histname = "ecalS9DepositedEnergy";
00058   addHisto( ecalS9DepEnergy_ =
00059             new PhysVarHisto( pre + histname, histname, 80, 0. ,40., currDir_, "", "vD" )
00060             );
00061   histname = "hadDepositedEnergy";
00062   addHisto( hcalDepEnergy_ =
00063             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00064             );
00065 
00066   histname = "hadS9DepositedEnergy";
00067   addHisto( hcalS9DepEnergy_ =
00068             new PhysVarHisto( pre + histname, histname, 80, 0. ,40., currDir_, "", "vD" )
00069             );
00070 
00071   histname = "hoDepositedEnergy";
00072   addHisto( hoDepEnergy_ =
00073             new PhysVarHisto( pre + histname, histname, 50, 0. ,20. , currDir_, "", "vD" )
00074             );
00075 
00076   histname = "hoS9DepositedEnergy";
00077   addHisto( hoS9DepEnergy_ =
00078             new PhysVarHisto( pre + histname, histname, 50, 0. ,20. , currDir_, "", "vD" )
00079             );
00080 
00081 
00082 
00084 /*
00085   histname = "NumberOfRecHitsPerSeed";
00086   addHisto( NumberOfRecHitsPerSeed_ =
00087             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00088             );
00089 
00090   histname = "seedPhi";
00091   addHisto( seedPhi_ =
00092             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00093             );
00094   histname = "seedEta";
00095   addHisto( seedEta_ =
00096             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00097             );
00098   histname = "seedTheta";
00099   addHisto( seedTheta_ =
00100             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00101             );
00102   histname = "seedPt";
00103   addHisto( seedPt_ =
00104             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00105             );
00106  histname = "seedPx";
00107   addHisto( seedPx_ =
00108             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00109             );
00110  histname = "seedPy";
00111   addHisto( seedPy_ =
00112             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00113             );
00114   histname = "seedPz";
00115   addHisto( seedPz_ =
00116             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00117             );
00118   histname = "seedPtErrOverPt";
00119   addHisto( seedPtErr_ =
00120             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00121             );
00122   histname = "seedPErrOverP";
00123   addHisto( seedPErr_ =
00124             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00125             );
00126   histname = "seedPxErrOverPx";
00127   addHisto( seedPxErr_ =
00128             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00129             );
00130   histname = "seedPyErrOverPy";
00131   addHisto( seedPyErr_ =
00132             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00133             );
00134   histname = "seedPzErrOverPz";
00135   addHisto( seedPzErr_ =
00136             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00137             );
00138   histname = "seedPhiErr";
00139   addHisto( seedPhiErr_ =
00140             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00141             );
00142   histname = "seedEtaErr";
00143   addHisto( seedEtaErr_ =
00144             new PhysVarHisto( pre + histname, histname, 65, -0.5, 64.5, currDir_, "", "vD" )
00145             );
00146 */
00147 
00148 
00149 //muon reco begin
00150 
00151   addHisto( muReco_ =
00152             new PhysVarHisto( pre + "Reco", "muReco", 6, 1, 7, currDir_, "", "vD" )
00153             );
00154 
00155   histname = "GlbMuon";
00156   PhysVarHisto * temp;
00157   addHisto( temp =
00158             new PhysVarHisto( pre + histname+"Glbeta", histname+"Glb_eta", 100, -20., 20., currDir_, "", "vD" )
00159             );
00160   etaGlbTrack_.push_back(temp);
00161 
00162   addHisto( temp =
00163             new PhysVarHisto( pre + histname+"Tketa", histname+"Tk_eta", 50, -4., 4., currDir_, "", "vD" )
00164             );
00165   etaGlbTrack_.push_back(temp);
00166 
00167   addHisto( temp  =
00168             new PhysVarHisto( pre + histname+"Staeta", histname+"Sta_eta", 100, -4., 4., currDir_, "", "vD" )
00169             );
00170   etaGlbTrack_.push_back(temp);
00171 
00172 
00173   addHisto( temp   =
00174             new PhysVarHisto( pre + "ResTkGlbeta", "Res_TkGlb_eta", 50,  -4. , 4. , currDir_, "", "vD" )
00175             );
00176   etaResolution_.push_back(temp);
00177 
00178   addHisto(  temp  =
00179             new PhysVarHisto( pre + "ResGlbStaeta", "Res_GlbSta_eta", 100, -4., 4., currDir_, "", "vD" )
00180             );
00181   etaResolution_.push_back(temp);
00182 
00183   addHisto(  temp   =
00184             new PhysVarHisto( pre + "ResTkStaeta", "Res_TkSta_eta", 100, -4., 4., currDir_, "", "vD" )
00185             );
00186   etaResolution_.push_back(temp);
00187 
00188 
00189   addHisto( etaTrack_ =
00190             new PhysVarHisto( pre + "TkMuoneta", "TkMuon_eta", 100, -4., 4., currDir_, "", "vD" )
00191             );
00192 
00193   addHisto( etaStaTrack_ =
00194             new PhysVarHisto( pre + "StaMuoneta", "StaMuon_eta", 100, -4., 4., currDir_, "", "vD" )
00195             );
00196 
00197   addHisto( temp =
00198             new PhysVarHisto( pre + histname+"Glbtheta", histname+"Glb_theta", 50, 0., 4., currDir_, "", "vD" )
00199             );
00200   thetaGlbTrack_.push_back(temp);
00201 
00202   addHisto( temp =
00203             new PhysVarHisto( pre + histname+"Tktheta", histname+"Tk_theta", 50, 0., 4., currDir_, "", "vD" )
00204             );
00205   thetaGlbTrack_.push_back(temp);
00206 
00207   addHisto(  temp  =
00208             new PhysVarHisto( pre + histname+"Statheta", histname+"Sta_theta", 50, 0. , 4., currDir_, "", "vD" )
00209             );
00210   thetaGlbTrack_.push_back(temp);
00211 
00212   addHisto(  temp   =
00213             new PhysVarHisto( pre + "ResTkGlbtheta", "Res_TkGlb_theta", 50, 0. , 4., currDir_, "", "vD" )
00214             );
00215   thetaResolution_.push_back(temp);
00216 
00217   addHisto(  temp   =
00218             new PhysVarHisto( pre + "ResGlbStatheta", "Res_GlbSta_theta", 50, 0. , 4. , currDir_, "", "vD" )
00219             );
00220   thetaResolution_.push_back(temp);
00221 
00222   addHisto(  temp   =
00223             new PhysVarHisto( pre + "ResTkStatheta", "Res_TkSta_theta", 50, 0. , 4. , currDir_, "", "vD" )
00224             );
00225   thetaResolution_.push_back(temp);
00226 
00227   addHisto( thetaTrack_ =
00228             new PhysVarHisto( pre + "TkMuontheta", "TkMuon_theta",  50, 0. , 4. , currDir_, "", "vD" )
00229             );
00230 
00231   addHisto( thetaStaTrack_ =
00232             new PhysVarHisto( pre + "StaMuontheta", "StaMuon_theta", 50, 0., 4., currDir_, "", "vD" )
00233             );
00234 
00235   addHisto( temp =
00236             new PhysVarHisto( pre + histname+"Glbphi", histname+"Glb_phi", 100, -4., 4., currDir_, "", "vD" )
00237             );
00238   phiGlbTrack_.push_back(temp);
00239 
00240   addHisto(  temp  =
00241             new PhysVarHisto( pre + histname+"Tkphi", histname+"Tk_phi", 50, -4., 4., currDir_, "", "vD" )
00242             );
00243   phiGlbTrack_.push_back(temp);
00244 
00245   addHisto(  temp  =
00246             new PhysVarHisto( pre + histname+"Staphi", histname+"Sta_phi", 100, -4.,  4., currDir_, "", "vD" )
00247             );
00248   phiGlbTrack_.push_back(temp);
00249 
00250   addHisto( temp  =
00251             new PhysVarHisto( pre + "ResTkGlbphi", "Res_TkGlb_phi", 50, 0., 4., currDir_, "", "vD" )
00252             );
00253   phiResolution_.push_back(temp);
00254 
00255   addHisto(  temp  =
00256             new PhysVarHisto( pre + "ResGlbStaphi", "Res_GlbSta_phi", 50, -1., 4., currDir_, "", "vD" )
00257             );
00258   phiResolution_.push_back(temp);
00259 
00260   addHisto(  temp   =
00261             new PhysVarHisto( pre + "ResTkStaphi", "Res_TkSta_phi",  50, -1., 4., currDir_, "", "vD" )
00262             );
00263   phiResolution_.push_back(temp);
00264 
00265   addHisto( phiTrack_ =
00266             new PhysVarHisto( pre + "TkMuonphi", "TkMuon_phi", 50, -4. , 4., currDir_, "", "vD" )
00267             );
00268   addHisto( phiStaTrack_ =
00269             new PhysVarHisto( pre + "StaMuonphi", "StaMuon_phi", 50, -4. , 4., currDir_, "", "vD" )
00270             );
00271 
00272   addHisto( temp  =
00273             new PhysVarHisto( pre + histname+"Glbp", histname+"Glb_p", 100, 0., 100, currDir_, "", "vD" )
00274             );
00275   pGlbTrack_.push_back(temp);
00276 
00277   addHisto( temp  =
00278             new PhysVarHisto( pre + histname+"Tkp", histname+"Tk_p", 100, 0., 100., currDir_, "", "vD" )
00279             );
00280   pGlbTrack_.push_back(temp);
00281 
00282   addHisto(  temp   =
00283             new PhysVarHisto( pre + histname+"Stap", histname+"Sta_p", 100, 0., 100., currDir_, "", "vD" )
00284             );
00285   pGlbTrack_.push_back(temp);
00286 
00287   addHisto( pTrack_ =
00288             new PhysVarHisto( pre + "TkMuonp", "TkMuon_p", 100, 0., 100., currDir_, "", "vD" )
00289             );
00290   addHisto( pStaTrack_ =
00291             new PhysVarHisto( pre + "StaMuonp", "StaMuon_p", 100, 0., 100., currDir_, "", "vD" )
00292             );
00293 
00294   addHisto( temp  =
00295             new PhysVarHisto( pre + histname+"Glbpt", histname+"Glb_pt", 100,  0., 100., currDir_, "", "vD" )
00296             );
00297   ptGlbTrack_.push_back(temp);
00298 
00299   addHisto(  temp   =
00300             new PhysVarHisto( pre + histname+"Tkpt", histname+"Tk_pt", 100, 0., 100., currDir_, "", "vD" )
00301             );
00302   ptGlbTrack_.push_back(temp);
00303 
00304   addHisto( temp   =
00305             new PhysVarHisto( pre + histname+"Stapt", histname+"Sta_pt", 100, 0., 100., currDir_, "", "vD" )
00306             );
00307   ptGlbTrack_.push_back(temp);
00308 
00309   addHisto( ptTrack_ =
00310             new PhysVarHisto( pre + "TkMuonpt", "TkMuon_pt", 65, -0.5, 64.5, currDir_, "", "vD" )
00311             );
00312   addHisto(  ptStaTrack_ =
00313             new PhysVarHisto( pre + "StaMuonpt", "StaMuon_pt", 65, -0.5, 64.5, currDir_, "", "vD" )
00314             );
00315 
00316   addHisto( temp  =
00317             new PhysVarHisto( pre + histname+"Glbq", histname+"Glb_q", 100, -4., 4., currDir_, "", "vD" )
00318             );
00319   qGlbTrack_.push_back(temp);
00320 
00321   addHisto(  temp   =
00322             new PhysVarHisto( pre + histname+"Tkq", histname+"Tk_q", 50, -4., 4., currDir_, "", "vD" )
00323             );
00324   qGlbTrack_.push_back(temp);
00325 
00326   addHisto(  temp    =
00327             new PhysVarHisto( pre + histname+"Staq", histname+"Sta_q", 50, -4. , 4., currDir_, "", "vD" )
00328             );
00329   qGlbTrack_.push_back(temp);
00330 
00331   addHisto( temp  =
00332             new PhysVarHisto( pre + histname+"qComparison", histname+"qComparison", 50, 0., 20., currDir_, "", "vD" )
00333             );
00334   qGlbTrack_.push_back(temp);
00335 
00336   addHisto( qTrack_ =
00337             new PhysVarHisto( pre + "TkMuonq", "TkMuon_q", 50, -4. ,4., currDir_, "", "vD" )
00338             );
00339   addHisto( qStaTrack_ =
00340             new PhysVarHisto( pre + "StaMuonq", "StaMuon_q", 50, -4. ,4.,  currDir_, "", "vD" )
00341             );
00342 
00343   addHisto( temp =
00344             new PhysVarHisto( pre + "ResTkGlbqOverp", "Res_TkGlb_qOverp", 50, 0., 4., currDir_, "", "vD" )
00345             );
00346   qOverpResolution_.push_back(temp);
00347 
00348   addHisto(  temp  =
00349             new PhysVarHisto( pre + "ResGlbStaqOverp", "Res_GlbSta_qOverp", 50, 0., 4., currDir_, "", "vD" )
00350             );
00351   qOverpResolution_.push_back(temp);
00352 
00353   addHisto(  temp  =
00354             new PhysVarHisto( pre + "ResTkStaqOverp", "Res_TkSta_qOverp", 50, 0., 4., currDir_, "", "vD" )
00355             );
00356   qOverpResolution_.push_back(temp);
00357 
00358   addHisto( temp  =
00359             new PhysVarHisto( pre + "ResTkGlboneOverp", "Res_TkGlb_oneOverp", 50, 0., 4., currDir_, "", "vD" )
00360             );
00361   oneOverpResolution_.push_back(temp);
00362 
00363   addHisto( temp  =
00364             new PhysVarHisto( pre + "ResGlbStaoneOverp", "Res_GlbSta_oneOverp", 50, 0., 4., currDir_, "", "vD" )
00365             );
00366   oneOverpResolution_.push_back(temp);
00367 
00368   addHisto(  temp =
00369             new PhysVarHisto( pre + "ResTkStaoneOverp", "Res_TkSta_oneOverp", 50, 0., 4., currDir_, "", "vD" )
00370             );
00371   oneOverpResolution_.push_back(temp);
00372 
00373   addHisto( temp  =
00374             new PhysVarHisto( pre + "ResTkGlbqOverpt", "Res_TkGlb_qOverpt", 50, 0., 4., currDir_, "", "vD" )
00375             );
00376   qOverptResolution_.push_back(temp);
00377 
00378   addHisto( temp =
00379             new PhysVarHisto( pre + "ResGlbStaqOverpt", "Res_GlbSta_qOverpt", 50, 0., 4., currDir_, "", "vD" )
00380             );
00381   qOverptResolution_.push_back(temp);
00382 
00383   addHisto( temp =
00384             new PhysVarHisto( pre + "ResTkStaqOverpt", "Res_TkSta_qOverpt", 50, 0., 4., currDir_, "", "vD" )
00385             );
00386   qOverptResolution_.push_back(temp);
00387 
00388   addHisto( temp =
00389             new PhysVarHisto( pre + "ResTkGlboneOverpt", "Res_TkGlb_oneOverpt", 50, 0., 4., currDir_, "", "vD" )
00390             );
00391   oneOverptResolution_.push_back(temp);
00392 
00393   addHisto( temp =
00394             new PhysVarHisto( pre + "ResGlbStaoneOverpt", "Res_GlbSta_oneOverpt", 50, 0., 4., currDir_, "", "vD" )
00395             );
00396   oneOverptResolution_.push_back(temp);
00397 
00398   addHisto( temp =
00399             new PhysVarHisto( pre + "ResTkStaoneOverpt", "Res_TkSta_oneOverpt", 50, 0., 4., currDir_, "", "vD" )
00400             );
00401   oneOverptResolution_.push_back(temp);
00402 // muon reco end
00403 
00404 
00405 // Muon Track
00406 //Global Muon
00407   addHisto( GlbhitsNotUsed_ =
00408             new PhysVarHisto( pre + "GlbHitsNotUsedForGlobalTracking", "GlbHitsNotUsedForGlobalTracking", 50, -0.5, 49.5, currDir_, "", "vD" )
00409             );
00410   addHisto( GlbhitsNotUsedPercentual_ =
00411             new PhysVarHisto( pre + "GlbHitsNotUsedForGlobalTrackingDvHitUsed", "GlbHitsNotUsedForGlobalTrackingDvHitUsed" , 100, 0, 1., currDir_, "", "vD" )
00412             );
00413   addHisto( GlbhitStaProvenance_ =
00414             new PhysVarHisto( pre + "GlbtrackHitStaProvenance", "GlbtrackHitStaProvenance",  7, 0.5, 7.5, currDir_, "", "vD" )
00415             );
00416   addHisto( GlbhitTkrProvenance_ =
00417             new PhysVarHisto( pre + "GlbtrackHitTkrProvenance", "GlbtrackHitTkrProvenance",  6, 0.5, 6.5, currDir_, "", "vD" )
00418             );
00419 
00420 //StandAlone Muon
00421   addHisto( StahitsNotUsed_ =
00422             new PhysVarHisto( pre + "StaHitsNotUsedForGlobalTracking", "StaHitsNotUsedForGlobalTracking", 50, -0.5, 49.5, currDir_, "", "vD" )
00423             );
00424   addHisto( StahitsNotUsedPercentual_ =
00425             new PhysVarHisto( pre + "StaHitsNotUsedForGlobalTrackingDvHitUsed", "StaHitsNotUsedForGlobalTrackingDvHitUsed" , 100, 0, 1., currDir_, "", "vD" )
00426             );
00427   addHisto( StahitStaProvenance_ =
00428             new PhysVarHisto( pre + "StatrackHitStaProvenance", "StatrackHitStaProvenance",  7, 0.5, 7.5, currDir_, "", "vD" )
00429             );
00430   addHisto( StahitTkrProvenance_ =
00431             new PhysVarHisto( pre + "StatrackHitTkrProvenance", "StatrackHitTkrProvenance",  6, 0.5, 6.5, currDir_, "", "vD" )
00432             );
00433 
00434 
00435 }
00436 
00437 
00438 // fill a plain ol' muon
00439 void HistoMuon::fill( const Muon *muon, uint iMu, double weight )
00440 {
00441 
00442   // First fill common 4-vector histograms
00443 
00444   HistoGroup<Muon>::fill( muon, iMu, weight);
00445 
00446   // fill relevant muon histograms
00447   h_trackIso_->fill( muon->trackIso(), iMu , weight);
00448   h_caloIso_ ->fill( muon->caloIso() , iMu , weight);
00449   h_leptonID_->fill( muon->isGood(), iMu , weight);
00450 
00451   h_nChambers_->fill( muon->numberOfChambers(), iMu , weight);
00452 
00453   h_calCompat_->fill( muon->caloCompatibility(), iMu, weight );
00454   h_type_->fill( muon->type(), iMu, weight );
00455   reco::MuonEnergy muEnergy = muon->calEnergy();
00456 
00457   h_caloE_->fill( muEnergy.em+muEnergy.had+muEnergy.ho, iMu , weight);
00458 
00459 
00460 
00462 
00463   // get all the mu energy deposits
00464   ecalDepEnergy_->fill(muEnergy.em, iMu, weight);
00465 
00466   hcalDepEnergy_->fill(muEnergy.had, iMu, weight);
00467 
00468   hoDepEnergy_->fill(muEnergy.ho, iMu, weight);
00469 
00470   ecalS9DepEnergy_->fill(muEnergy.emS9, iMu, weight);
00471 
00472   hcalS9DepEnergy_->fill(muEnergy.hadS9, iMu, weight);
00473 
00474   hoS9DepEnergy_->fill(muEnergy.hoS9, iMu, weight);
00475 
00477 // Muon reco fill
00478 
00479   if( muon->isGlobalMuon()) {
00480     if(muon->isTrackerMuon() &&  muon->isStandAloneMuon())
00481       muReco_->fill(1, iMu, weight);
00482     if(!( muon->isTrackerMuon()) &&  muon->isStandAloneMuon())
00483       muReco_->fill(2, iMu, weight);
00484     if(! muon->isStandAloneMuon());
00485 
00486 
00487     // get the track combinig the information from both the Tracker and the Spectrometer
00488     reco::TrackRef recoCombinedGlbTrack = muon->combinedMuon();
00489     // get the track using only the tracker data
00490     reco::TrackRef recoGlbTrack = muon->track();
00491     // get the track using only the mu spectrometer data
00492     reco::TrackRef recoStaGlbTrack = muon->standAloneMuon();
00493   
00494     etaGlbTrack_[0]->fill(recoCombinedGlbTrack->eta(), iMu, weight);
00495     etaGlbTrack_[1]->fill(recoGlbTrack->eta(), iMu, weight);
00496     etaGlbTrack_[2]->fill(recoStaGlbTrack->eta(), iMu, weight);
00497     etaResolution_[0]->fill(recoGlbTrack->eta()-recoCombinedGlbTrack->eta(), iMu, weight);
00498     etaResolution_[1]->fill(-recoStaGlbTrack->eta()+recoCombinedGlbTrack->eta(), iMu, weight);
00499     etaResolution_[2]->fill(recoGlbTrack->eta()-recoStaGlbTrack->eta(), iMu, weight);
00500 // two dimensional histos
00501 //    etaResolution_[3]->fill(recoCombinedGlbTrack->eta(), recoGlbTrack->eta()-recoCombinedGlbTrack->eta());
00502 //    etaResolution_[4]->fill(recoCombinedGlbTrack->eta(), -recoStaGlbTrack->eta()+recoCombinedGlbTrack->eta());
00503 //    etaResolution_[5]->fill(recoCombinedGlbTrack->eta(), recoGlbTrack->eta()-recoStaGlbTrack->eta());
00504 
00505     thetaGlbTrack_[0]->fill(recoCombinedGlbTrack->theta(), iMu, weight);
00506     thetaGlbTrack_[1]->fill(recoGlbTrack->theta(), iMu, weight);
00507     thetaGlbTrack_[2]->fill(recoStaGlbTrack->theta(), iMu, weight);
00508     thetaResolution_[0]->fill(recoGlbTrack->theta()-recoCombinedGlbTrack->theta(), iMu, weight);
00509     thetaResolution_[1]->fill(-recoStaGlbTrack->theta()+recoCombinedGlbTrack->theta(), iMu, weight);
00510     thetaResolution_[2]->fill(recoGlbTrack->theta()-recoStaGlbTrack->theta(), iMu, weight);
00511 // two dimensional histos
00512 //    thetaResolution_[3]->fill(recoCombinedGlbTrack->theta(), recoGlbTrack->theta()-recoCombinedGlbTrack->theta());
00513 //    thetaResolution_[4]->fill(recoCombinedGlbTrack->theta(), -recoStaGlbTrack->theta()+recoCombinedGlbTrack->theta());
00514 //    thetaResolution_[5]->fill(recoCombinedGlbTrack->theta(), recoGlbTrack->theta()-recoStaGlbTrack->theta());
00515       
00516     phiGlbTrack_[0]->fill(recoCombinedGlbTrack->phi(), iMu, weight);
00517     phiGlbTrack_[1]->fill(recoGlbTrack->phi(), iMu, weight);
00518     phiGlbTrack_[2]->fill(recoStaGlbTrack->phi(), iMu, weight);
00519     phiResolution_[0]->fill(recoGlbTrack->phi()-recoCombinedGlbTrack->phi(), iMu, weight);
00520     phiResolution_[1]->fill(-recoStaGlbTrack->phi()+recoCombinedGlbTrack->phi(), iMu, weight);
00521     phiResolution_[2]->fill(recoGlbTrack->phi()-recoStaGlbTrack->phi(), iMu, weight);
00522 // two dimensional histos
00523 //    phiResolution_[3]->fill(recoCombinedGlbTrack->phi(), recoGlbTrack->phi()-recoCombinedGlbTrack->phi());
00524 //    phiResolution_[4]->fill(recoCombinedGlbTrack->phi(), -recoStaGlbTrack->phi()+recoCombinedGlbTrack->phi());
00525 //    phiResolution_[5]->fill(recoCombinedGlbTrack->phi(), recoGlbTrack->phi()-recoStaGlbTrack->phi());
00526      
00527     pGlbTrack_[0]->fill(recoCombinedGlbTrack->p(), iMu, weight);
00528     pGlbTrack_[1]->fill(recoGlbTrack->p(), iMu, weight);
00529     pGlbTrack_[2]->fill(recoStaGlbTrack->p(), iMu, weight);
00530  
00531     ptGlbTrack_[0]->fill(recoCombinedGlbTrack->pt(), iMu, weight);
00532     ptGlbTrack_[1]->fill(recoGlbTrack->pt(), iMu, weight);
00533     ptGlbTrack_[2]->fill(recoStaGlbTrack->pt(), iMu, weight);
00534  
00535     qGlbTrack_[0]->fill(recoCombinedGlbTrack->charge(), iMu, weight);
00536     qGlbTrack_[1]->fill(recoGlbTrack->charge(), iMu, weight);
00537     qGlbTrack_[2]->fill(recoStaGlbTrack->charge(), iMu, weight);
00538     if(recoCombinedGlbTrack->charge()==recoStaGlbTrack->charge()) qGlbTrack_[3]->fill(1, iMu, weight);
00539     else qGlbTrack_[3]->fill(2, iMu, weight);
00540     if(recoCombinedGlbTrack->charge()==recoGlbTrack->charge()) qGlbTrack_[3]->fill(3, iMu, weight);
00541     else qGlbTrack_[3]->fill(4, iMu, weight);
00542     if(recoStaGlbTrack->charge()==recoGlbTrack->charge()) qGlbTrack_[3]->fill(5, iMu, weight);
00543     else qGlbTrack_[3]->fill(6, iMu, weight);
00544     if(recoCombinedGlbTrack->charge()!=recoStaGlbTrack->charge() && recoCombinedGlbTrack->charge()!=recoGlbTrack->charge()) qGlbTrack_[3]->fill(7, iMu, weight);
00545     if(recoCombinedGlbTrack->charge()==recoStaGlbTrack->charge() && recoCombinedGlbTrack->charge()==recoGlbTrack->charge()) qGlbTrack_[3]->fill(8, iMu, weight);
00546      
00547     qOverpResolution_[0]->fill((recoGlbTrack->charge()/recoGlbTrack->p())-(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->p()), iMu, weight);
00548     qOverpResolution_[1]->fill(-(recoStaGlbTrack->charge()/recoStaGlbTrack->p())+(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->p()), iMu, weight);
00549     qOverpResolution_[2]->fill((recoGlbTrack->charge()/recoGlbTrack->p())-(recoStaGlbTrack->charge()/recoStaGlbTrack->p()), iMu, weight);
00550     oneOverpResolution_[0]->fill((1/recoGlbTrack->p())-(1/recoCombinedGlbTrack->p()), iMu, weight);
00551     oneOverpResolution_[1]->fill(-(1/recoStaGlbTrack->p())+(1/recoCombinedGlbTrack->p()), iMu, weight);
00552     oneOverpResolution_[2]->fill((1/recoGlbTrack->p())-(1/recoStaGlbTrack->p()), iMu, weight);
00553     qOverptResolution_[0]->fill((recoGlbTrack->charge()/recoGlbTrack->pt())-(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->pt()), iMu, weight);
00554     qOverptResolution_[1]->fill(-(recoStaGlbTrack->charge()/recoStaGlbTrack->pt())+(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->pt()), iMu, weight);
00555     qOverptResolution_[2]->fill((recoGlbTrack->charge()/recoGlbTrack->pt())-(recoStaGlbTrack->charge()/recoStaGlbTrack->pt()), iMu, weight);
00556     oneOverptResolution_[0]->fill((1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()), iMu, weight);
00557     oneOverptResolution_[1]->fill(-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()), iMu, weight);
00558     oneOverptResolution_[2]->fill((1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()), iMu, weight);
00559 //  two dimensional histos
00560 //    oneOverptResolution_[3]->fill(recoCombinedGlbTrack->eta(),(1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00561 //    oneOverptResolution_[4]->fill(recoCombinedGlbTrack->eta(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00562 //    oneOverptResolution_[5]->fill(recoCombinedGlbTrack->eta(),(1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00563 //    oneOverptResolution_[6]->fill(recoCombinedGlbTrack->phi(),(1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00564 //    oneOverptResolution_[7]->fill(recoCombinedGlbTrack->phi(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00565 //    oneOverptResolution_[8]->fill(recoCombinedGlbTrack->phi(),(1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00566 //    oneOverptResolution_[9]->fill(recoCombinedGlbTrack->pt(),(1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00567 //    oneOverptResolution_[10]->fill(recoCombinedGlbTrack->pt(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00568 //    oneOverptResolution_[11]->fill(recoCombinedGlbTrack->pt(),(1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00569 
00570   }
00571 
00572 
00573 
00574   if(muon->isTrackerMuon() && !(muon->isGlobalMuon())) {
00575      if(muon->isStandAloneMuon())
00576        muReco_->fill(3, iMu, weight);
00577      if(!(muon->isStandAloneMuon()))
00578        muReco_->fill(4, iMu, weight);
00579  
00580     // get the track using only the tracker data
00581     reco::TrackRef recoTrack = muon->track();
00582 
00583     etaTrack_->fill(recoTrack->eta(), iMu, weight);
00584     thetaTrack_->fill(recoTrack->theta(), iMu, weight);
00585     phiTrack_->fill(recoTrack->phi(), iMu, weight);
00586     pTrack_->fill(recoTrack->p(), iMu, weight);
00587     ptTrack_->fill(recoTrack->pt(), iMu, weight);
00588     qTrack_->fill(recoTrack->charge(), iMu, weight);
00589   }
00590 
00591 
00592   if(muon->isStandAloneMuon() && !(muon->isGlobalMuon())) {
00593     if(!(muon->isTrackerMuon()))
00594       muReco_->fill(5, iMu, weight);
00595      
00596     // get the track using only the mu spectrometer data
00597     reco::TrackRef recoStaTrack = muon->standAloneMuon();
00598  
00599     etaStaTrack_->fill(recoStaTrack->eta(), iMu, weight);
00600     thetaStaTrack_->fill(recoStaTrack->theta(), iMu, weight);
00601     phiStaTrack_->fill(recoStaTrack->phi(), iMu, weight);
00602     pStaTrack_->fill(recoStaTrack->p(), iMu, weight);
00603     ptStaTrack_->fill(recoStaTrack->pt(), iMu, weight);
00604     qStaTrack_->fill(recoStaTrack->charge(), iMu, weight);
00605  
00606   }
00607      
00608   if(muon->isCaloMuon() && !(muon->isGlobalMuon()) && !(muon->isTrackerMuon()) && !(muon->isStandAloneMuon()))
00609     muReco_->fill(6, iMu, weight);
00610 
00611 // muon track
00612 //Global track
00613   if(muon->isGlobalMuon()){
00614    reco::Track const & GlbrecoTrack = *(muon->globalTrack());
00615    // hit counters
00616    int hitsFromDt=0;
00617    int hitsFromCsc=0;
00618    int hitsFromRpc=0;
00619    int hitsFromTk=0;
00620    int hitsFromTrack=0;
00621 //   int hitsFromSegmDt=0;
00622 //   int hitsFromSegmCsc=0;
00623    // segment counters
00624 //   int segmFromDt=0;
00625 //   int segmFromCsc=0;
00626 
00627 
00628    // hits from track
00629    for(trackingRecHit_iterator GlbrecHit =  GlbrecoTrack.recHitsBegin(); GlbrecHit != GlbrecoTrack.recHitsEnd(); ++GlbrecHit){
00630  
00631      hitsFromTrack++;
00632       DetId id = (*GlbrecHit)->geographicalId();
00633       // hits from DT
00634       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT ) 
00635         hitsFromDt++;   
00636       // hits from CSC
00637        if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC ) 
00638         hitsFromCsc++;
00639       // hits from RPC
00640       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::RPC ) 
00641         hitsFromRpc++;
00642       // hits from Tracker
00643       if (id.det() == DetId::Tracker){
00644         hitsFromTk++;
00645         if(id.subdetId() == PixelSubdetector::PixelBarrel )
00646           GlbhitTkrProvenance_->fill(1,  iMu,   weight);
00647         if(id.subdetId() == PixelSubdetector::PixelEndcap )
00648           GlbhitTkrProvenance_->fill(2,  iMu,   weight);
00649         if(id.subdetId() == SiStripDetId::TIB )
00650           GlbhitTkrProvenance_->fill(3,  iMu,   weight);
00651         if(id.subdetId() == SiStripDetId::TID )
00652           GlbhitTkrProvenance_->fill(4,  iMu,   weight);
00653         if(id.subdetId() == SiStripDetId::TOB )
00654           GlbhitTkrProvenance_->fill(5,  iMu,   weight);
00655         if(id.subdetId() == SiStripDetId::TEC )
00656           GlbhitTkrProvenance_->fill(6,  iMu,   weight);
00657       }
00658  
00659    }
00660  
00661    // fill the histos
00662 
00663 //   GlbhitsNotUsed_->fill(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack,  iMu,   weight);
00664 //   GlbhitsNotUsedPercentual_->fill(double(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack)/hitsFromTrack,  iMu,   weight);
00665  
00666    if(hitsFromDt!=0 && hitsFromCsc==0 && hitsFromRpc==0) GlbhitStaProvenance_->fill(1,  iMu,   weight);
00667    if(hitsFromCsc!=0 && hitsFromDt==0 && hitsFromRpc==0) GlbhitStaProvenance_->fill(2,  iMu,   weight);
00668    if(hitsFromRpc!=0 && hitsFromDt==0 && hitsFromCsc==0) GlbhitStaProvenance_->fill(3,  iMu,   weight);
00669    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc==0) GlbhitStaProvenance_->fill(4,  iMu,   weight);
00670    if(hitsFromDt!=0 && hitsFromRpc!=0 && hitsFromCsc==0) GlbhitStaProvenance_->fill(5,  iMu,   weight);
00671    if(hitsFromCsc!=0 && hitsFromRpc!=0 && hitsFromDt==0) GlbhitStaProvenance_->fill(6,  iMu,   weight);
00672    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc!=0) GlbhitStaProvenance_->fill(7,  iMu,   weight);
00673   }
00674 
00675 
00676 
00677 
00678 
00679 //StandAlone track
00680   if(muon->isStandAloneMuon()){
00681    reco::Track const & StarecoTrack = *(muon->standAloneMuon());
00682    // hit counters
00683    int hitsFromDt=0;
00684    int hitsFromCsc=0;
00685    int hitsFromRpc=0;
00686    int hitsFromTk=0;
00687    int hitsFromTrack=0;
00688 //   int hitsFromSegmDt=0;
00689 //   int hitsFromSegmCsc=0;
00690    // segment counters
00691 //   int segmFromDt=0;
00692 //   int segmFromCsc=0;
00693 
00694    // hits from track
00695    for(trackingRecHit_iterator StarecHit =  StarecoTrack.recHitsBegin(); StarecHit != StarecoTrack.recHitsEnd(); ++StarecHit){
00696 
00697      hitsFromTrack++;
00698       DetId id = (*StarecHit)->geographicalId();
00699       // hits from DT
00700       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT )
00701         hitsFromDt++;
00702       // hits from CSC
00703        if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC )
00704         hitsFromCsc++;
00705       // hits from RPC
00706       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::RPC )
00707         hitsFromRpc++;
00708       // hits from Tracker
00709       if (id.det() == DetId::Tracker){
00710         hitsFromTk++;
00711         if(id.subdetId() == PixelSubdetector::PixelBarrel )
00712           StahitTkrProvenance_->fill(1,  iMu,   weight);
00713         if(id.subdetId() == PixelSubdetector::PixelEndcap )
00714           StahitTkrProvenance_->fill(2,  iMu,   weight);
00715         if(id.subdetId() == SiStripDetId::TIB )
00716           StahitTkrProvenance_->fill(3,  iMu,   weight);
00717         if(id.subdetId() == SiStripDetId::TID )
00718           StahitTkrProvenance_->fill(4,  iMu,   weight);
00719         if(id.subdetId() == SiStripDetId::TOB )
00720           StahitTkrProvenance_->fill(5,  iMu,   weight);
00721         if(id.subdetId() == SiStripDetId::TEC )
00722           StahitTkrProvenance_->fill(6,  iMu,   weight);
00723       }
00724  
00725    }
00726 
00727    // fill the histos
00728 
00729 //   StahitsNotUsed_->fill(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack,  iMu,   weight);
00730 //   StahitsNotUsedPercentual_->fill(double(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack)/hitsFromTrack,  iMu,   weight);
00731 
00732    if(hitsFromDt!=0 && hitsFromCsc==0 && hitsFromRpc==0) StahitStaProvenance_->fill(1,  iMu,   weight);
00733    if(hitsFromCsc!=0 && hitsFromDt==0 && hitsFromRpc==0) StahitStaProvenance_->fill(2,  iMu,   weight);
00734    if(hitsFromRpc!=0 && hitsFromDt==0 && hitsFromCsc==0) StahitStaProvenance_->fill(3,  iMu,   weight);
00735    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc==0) StahitStaProvenance_->fill(4,  iMu,   weight);
00736    if(hitsFromDt!=0 && hitsFromRpc!=0 && hitsFromCsc==0) StahitStaProvenance_->fill(5,  iMu,   weight);
00737    if(hitsFromCsc!=0 && hitsFromRpc!=0 && hitsFromDt==0) StahitStaProvenance_->fill(6,  iMu,   weight);
00738    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc!=0) StahitStaProvenance_->fill(7,  iMu,   weight);
00739   }
00740 
00741 
00742 
00743 
00744 
00745 }
00746 
00747 
00748 // fill a muon that is a shallow clone, and take kinematics from 
00749 // shallow clone but detector plots from the muon itself
00750 void HistoMuon::fill( const reco::ShallowClonePtrCandidate *pshallow, uint iMu, double weight )
00751 {
00752 
00753   // Get the underlying object that the shallow clone represents
00754   const pat::Muon * muon = dynamic_cast<const pat::Muon*>(pshallow);
00755 
00756   if ( muon == 0 ) {
00757     cout << "Error! Was passed a shallow clone that is not at heart a muon" << endl;
00758     return;
00759   }
00760 
00761   
00762 
00763   // First fill common 4-vector histograms from shallow clone
00764 
00765   HistoGroup<Muon>::fill( pshallow, iMu, weight);
00766 
00767   // fill relevant muon histograms from muon
00768   h_trackIso_->fill( muon->trackIso(), iMu , weight);
00769   h_caloIso_ ->fill( muon->caloIso() , iMu , weight);
00770   h_leptonID_->fill( muon->isGood(), iMu , weight);
00771 
00772   h_nChambers_->fill( muon->numberOfChambers(), iMu , weight);
00773 
00774   h_calCompat_->fill( muon->caloCompatibility(), iMu, weight );
00775   h_type_->fill( muon->type(), iMu, weight );
00776   reco::MuonEnergy muEnergy = muon->calEnergy();
00777 
00778   h_caloE_->fill( muEnergy.em+muEnergy.had+muEnergy.ho, iMu , weight);
00779 
00781 
00782   // get all the mu energy deposits
00783   ecalDepEnergy_->fill(muEnergy.em, iMu, weight);
00784 
00785   hcalDepEnergy_->fill(muEnergy.had, iMu, weight);
00786 
00787   hoDepEnergy_->fill(muEnergy.ho, iMu, weight);
00788 
00789   ecalS9DepEnergy_->fill(muEnergy.emS9, iMu, weight);
00790 
00791   hcalS9DepEnergy_->fill(muEnergy.hadS9, iMu, weight);
00792 
00793   hoS9DepEnergy_->fill(muEnergy.hoS9, iMu, weight);
00794 
00795 
00796 
00798 // Muon reco fill
00799 
00800   if( muon->isGlobalMuon()) {
00801     if(muon->isTrackerMuon() &&  muon->isStandAloneMuon())
00802       muReco_->fill(1, iMu, weight);
00803     if(!( muon->isTrackerMuon()) &&  muon->isStandAloneMuon())
00804       muReco_->fill(2, iMu, weight);
00805     if(! muon->isStandAloneMuon());
00806 
00807 
00808     // get the track combinig the information from both the Tracker and the Spectrometer
00809     reco::TrackRef recoCombinedGlbTrack = muon->combinedMuon();
00810     // get the track using only the tracker data
00811     reco::TrackRef recoGlbTrack = muon->track();
00812     // get the track using only the mu spectrometer data
00813     reco::TrackRef recoStaGlbTrack = muon->standAloneMuon();
00814   
00815     etaGlbTrack_[0]->fill(recoCombinedGlbTrack->eta(), iMu, weight);
00816     etaGlbTrack_[1]->fill(recoGlbTrack->eta(), iMu, weight);
00817     etaGlbTrack_[2]->fill(recoStaGlbTrack->eta(), iMu, weight);
00818     etaResolution_[0]->fill(recoGlbTrack->eta()-recoCombinedGlbTrack->eta(), iMu, weight);
00819     etaResolution_[1]->fill(-recoStaGlbTrack->eta()+recoCombinedGlbTrack->eta(), iMu, weight);
00820     etaResolution_[2]->fill(recoGlbTrack->eta()-recoStaGlbTrack->eta(), iMu, weight);
00821 //    etaResolution_[3]->fill(recoCombinedGlbTrack->eta(), recoGlbTrack->eta()-recoCombinedGlbTrack->eta());
00822 //    etaResolution_[4]->fill(recoCombinedGlbTrack->eta(), -recoStaGlbTrack->eta()+recoCombinedGlbTrack->eta());
00823 //    etaResolution_[5]->fill(recoCombinedGlbTrack->eta(), recoGlbTrack->eta()-recoStaGlbTrack->eta());
00824 
00825     thetaGlbTrack_[0]->fill(recoCombinedGlbTrack->theta(), iMu, weight);
00826     thetaGlbTrack_[1]->fill(recoGlbTrack->theta(), iMu, weight);
00827     thetaGlbTrack_[2]->fill(recoStaGlbTrack->theta(), iMu, weight);
00828     thetaResolution_[0]->fill(recoGlbTrack->theta()-recoCombinedGlbTrack->theta(), iMu, weight);
00829     thetaResolution_[1]->fill(-recoStaGlbTrack->theta()+recoCombinedGlbTrack->theta(), iMu, weight);
00830     thetaResolution_[2]->fill(recoGlbTrack->theta()-recoStaGlbTrack->theta(), iMu, weight);
00831 //    thetaResolution_[3]->fill(recoCombinedGlbTrack->theta(), recoGlbTrack->theta()-recoCombinedGlbTrack->theta());
00832 //    thetaResolution_[4]->fill(recoCombinedGlbTrack->theta(), -recoStaGlbTrack->theta()+recoCombinedGlbTrack->theta());
00833 //    thetaResolution_[5]->fill(recoCombinedGlbTrack->theta(), recoGlbTrack->theta()-recoStaGlbTrack->theta());
00834       
00835     phiGlbTrack_[0]->fill(recoCombinedGlbTrack->phi(), iMu, weight);
00836     phiGlbTrack_[1]->fill(recoGlbTrack->phi(), iMu, weight);
00837     phiGlbTrack_[2]->fill(recoStaGlbTrack->phi(), iMu, weight);
00838     phiResolution_[0]->fill(recoGlbTrack->phi()-recoCombinedGlbTrack->phi(), iMu, weight);
00839     phiResolution_[1]->fill(-recoStaGlbTrack->phi()+recoCombinedGlbTrack->phi(), iMu, weight);
00840     phiResolution_[2]->fill(recoGlbTrack->phi()-recoStaGlbTrack->phi(), iMu, weight);
00841 //    phiResolution_[3]->fill(recoCombinedGlbTrack->phi(), recoGlbTrack->phi()-recoCombinedGlbTrack->phi());
00842 //    phiResolution_[4]->fill(recoCombinedGlbTrack->phi(), -recoStaGlbTrack->phi()+recoCombinedGlbTrack->phi());
00843 //    phiResolution_[5]->fill(recoCombinedGlbTrack->phi(), recoGlbTrack->phi()-recoStaGlbTrack->phi());
00844      
00845     pGlbTrack_[0]->fill(recoCombinedGlbTrack->p(), iMu, weight);
00846     pGlbTrack_[1]->fill(recoGlbTrack->p(), iMu, weight);
00847     pGlbTrack_[2]->fill(recoStaGlbTrack->p(), iMu, weight);
00848  
00849     ptGlbTrack_[0]->fill(recoCombinedGlbTrack->pt(), iMu, weight);
00850     ptGlbTrack_[1]->fill(recoGlbTrack->pt(), iMu, weight);
00851     ptGlbTrack_[2]->fill(recoStaGlbTrack->pt(), iMu, weight);
00852  
00853     qGlbTrack_[0]->fill(recoCombinedGlbTrack->charge(), iMu, weight);
00854     qGlbTrack_[1]->fill(recoGlbTrack->charge(), iMu, weight);
00855     qGlbTrack_[2]->fill(recoStaGlbTrack->charge(), iMu, weight);
00856     if(recoCombinedGlbTrack->charge()==recoStaGlbTrack->charge()) qGlbTrack_[3]->fill(1, iMu, weight);
00857     else qGlbTrack_[3]->fill(2, iMu, weight);
00858     if(recoCombinedGlbTrack->charge()==recoGlbTrack->charge()) qGlbTrack_[3]->fill(3, iMu, weight);
00859     else qGlbTrack_[3]->fill(4, iMu, weight);
00860     if(recoStaGlbTrack->charge()==recoGlbTrack->charge()) qGlbTrack_[3]->fill(5, iMu, weight);
00861     else qGlbTrack_[3]->fill(6, iMu, weight);
00862     if(recoCombinedGlbTrack->charge()!=recoStaGlbTrack->charge() && recoCombinedGlbTrack->charge()!=recoGlbTrack->charge()) qGlbTrack_[3]->fill(7, iMu, weight);
00863     if(recoCombinedGlbTrack->charge()==recoStaGlbTrack->charge() && recoCombinedGlbTrack->charge()==recoGlbTrack->charge()) qGlbTrack_[3]->fill(8, iMu, weight);
00864      
00865     qOverpResolution_[0]->fill((recoGlbTrack->charge()/recoGlbTrack->p())-(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->p()), iMu, weight);
00866     qOverpResolution_[1]->fill(-(recoStaGlbTrack->charge()/recoStaGlbTrack->p())+(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->p()), iMu, weight);
00867     qOverpResolution_[2]->fill((recoGlbTrack->charge()/recoGlbTrack->p())-(recoStaGlbTrack->charge()/recoStaGlbTrack->p()), iMu, weight);
00868     oneOverpResolution_[0]->fill((1/recoGlbTrack->p())-(1/recoCombinedGlbTrack->p()), iMu, weight);
00869     oneOverpResolution_[1]->fill(-(1/recoStaGlbTrack->p())+(1/recoCombinedGlbTrack->p()), iMu, weight);
00870     oneOverpResolution_[2]->fill((1/recoGlbTrack->p())-(1/recoStaGlbTrack->p()), iMu, weight);
00871     qOverptResolution_[0]->fill((recoGlbTrack->charge()/recoGlbTrack->pt())-(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->pt()), iMu, weight);
00872     qOverptResolution_[1]->fill(-(recoStaGlbTrack->charge()/recoStaGlbTrack->pt())+(recoCombinedGlbTrack->charge()/recoCombinedGlbTrack->pt()), iMu, weight);
00873     qOverptResolution_[2]->fill((recoGlbTrack->charge()/recoGlbTrack->pt())-(recoStaGlbTrack->charge()/recoStaGlbTrack->pt()), iMu, weight);
00874     oneOverptResolution_[0]->fill((1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()), iMu, weight);
00875     oneOverptResolution_[1]->fill(-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()), iMu, weight);
00876     oneOverptResolution_[2]->fill((1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()), iMu, weight);
00877 //    oneOverptResolution_[3]->fill(recoCombinedGlbTrack->eta(),(1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00878 //    oneOverptResolution_[4]->fill(recoCombinedGlbTrack->eta(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00879 //    oneOverptResolution_[5]->fill(recoCombinedGlbTrack->eta(),(1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00880 //    oneOverptResolution_[6]->fill(recoCombinedGlbTrack->phi(),(1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00881 //    oneOverptResolution_[7]->fill(recoCombinedGlbTrack->phi(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00882 //    oneOverptResolution_[8]->fill(recoCombinedGlbTrack->phi(),(1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00883 //    oneOverptResolution_[9]->fill(recoCombinedGlbTrack->pt(),(1/recoGlbTrack->pt())-(1/recoCombinedGlbTrack->pt()));
00884 //    oneOverptResolution_[10]->fill(recoCombinedGlbTrack->pt(),-(1/recoStaGlbTrack->pt())+(1/recoCombinedGlbTrack->pt()));
00885 //    oneOverptResolution_[11]->fill(recoCombinedGlbTrack->pt(),(1/recoGlbTrack->pt())-(1/recoStaGlbTrack->pt()));
00886 
00887   }
00888 
00889 
00890 
00891   if(muon->isTrackerMuon() && !(muon->isGlobalMuon())) {
00892      if(muon->isStandAloneMuon())
00893        muReco_->fill(3, iMu, weight);
00894      if(!(muon->isStandAloneMuon()))
00895        muReco_->fill(4, iMu, weight);
00896  
00897     // get the track using only the tracker data
00898     reco::TrackRef recoTrack = muon->track();
00899 
00900     etaTrack_->fill(recoTrack->eta(), iMu, weight);
00901     thetaTrack_->fill(recoTrack->theta(), iMu, weight);
00902     phiTrack_->fill(recoTrack->phi(), iMu, weight);
00903     pTrack_->fill(recoTrack->p(), iMu, weight);
00904     ptTrack_->fill(recoTrack->pt(), iMu, weight);
00905     qTrack_->fill(recoTrack->charge(), iMu, weight);
00906   }
00907 
00908 
00909   if(muon->isStandAloneMuon() && !(muon->isGlobalMuon())) {
00910     if(!(muon->isTrackerMuon()))
00911       muReco_->fill(5, iMu, weight);
00912      
00913     // get the track using only the mu spectrometer data
00914     reco::TrackRef recoStaTrack = muon->standAloneMuon();
00915  
00916     etaStaTrack_->fill(recoStaTrack->eta(), iMu, weight);
00917     thetaStaTrack_->fill(recoStaTrack->theta(), iMu, weight);
00918     phiStaTrack_->fill(recoStaTrack->phi(), iMu, weight);
00919     pStaTrack_->fill(recoStaTrack->p(), iMu, weight);
00920     ptStaTrack_->fill(recoStaTrack->pt(), iMu, weight);
00921     qStaTrack_->fill(recoStaTrack->charge(), iMu, weight);
00922  
00923   }
00924      
00925   if(muon->isCaloMuon() && !(muon->isGlobalMuon()) && !(muon->isTrackerMuon()) && !(muon->isStandAloneMuon()))
00926     muReco_->fill(6, iMu, weight);
00927 
00928 // muon track
00929 //Global track
00930   if(muon->isGlobalMuon()){
00931    reco::Track const & GlbrecoTrack = *(muon->globalTrack());
00932    // hit counters
00933    int hitsFromDt=0;
00934    int hitsFromCsc=0;
00935    int hitsFromRpc=0;
00936    int hitsFromTk=0;
00937    int hitsFromTrack=0;
00938 //   int hitsFromSegmDt=0;
00939 //   int hitsFromSegmCsc=0;
00940    // segment counters
00941 //   int segmFromDt=0;
00942 //   int segmFromCsc=0;
00943 
00944 
00945    // hits from track
00946    for(trackingRecHit_iterator GlbrecHit =  GlbrecoTrack.recHitsBegin(); GlbrecHit != GlbrecoTrack.recHitsEnd(); ++GlbrecHit){
00947 
00948      hitsFromTrack++;
00949       DetId id = (*GlbrecHit)->geographicalId();
00950       // hits from DT
00951       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT )
00952         hitsFromDt++;
00953       // hits from CSC
00954        if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC )
00955         hitsFromCsc++;
00956       // hits from RPC
00957       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::RPC )
00958         hitsFromRpc++;
00959       // hits from Tracker
00960       if (id.det() == DetId::Tracker){
00961         hitsFromTk++;
00962         if(id.subdetId() == PixelSubdetector::PixelBarrel )
00963           GlbhitTkrProvenance_->fill(1,  iMu,   weight);
00964         if(id.subdetId() == PixelSubdetector::PixelEndcap )
00965           GlbhitTkrProvenance_->fill(2,  iMu,   weight);
00966         if(id.subdetId() == SiStripDetId::TIB )
00967           GlbhitTkrProvenance_->fill(3,  iMu,   weight);
00968         if(id.subdetId() == SiStripDetId::TID )
00969           GlbhitTkrProvenance_->fill(4,  iMu,   weight);
00970         if(id.subdetId() == SiStripDetId::TOB )
00971           GlbhitTkrProvenance_->fill(5,  iMu,   weight);
00972         if(id.subdetId() == SiStripDetId::TEC )
00973           GlbhitTkrProvenance_->fill(6,  iMu,   weight);
00974       }
00975 
00976    }
00977 
00978    // fill the histos
00979 
00980 //   GlbhitsNotUsed_->fill(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack,  iMu,   weight);
00981 //   GlbhitsNotUsedPercentual_->fill(double(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack)/hitsFromTrack,  iMu,   weight);
00982 
00983    if(hitsFromDt!=0 && hitsFromCsc==0 && hitsFromRpc==0) GlbhitStaProvenance_->fill(1,  iMu,   weight);
00984    if(hitsFromCsc!=0 && hitsFromDt==0 && hitsFromRpc==0) GlbhitStaProvenance_->fill(2,  iMu,   weight);
00985    if(hitsFromRpc!=0 && hitsFromDt==0 && hitsFromCsc==0) GlbhitStaProvenance_->fill(3,  iMu,   weight);
00986    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc==0) GlbhitStaProvenance_->fill(4,  iMu,   weight);
00987    if(hitsFromDt!=0 && hitsFromRpc!=0 && hitsFromCsc==0) GlbhitStaProvenance_->fill(5,  iMu,   weight);
00988    if(hitsFromCsc!=0 && hitsFromRpc!=0 && hitsFromDt==0) GlbhitStaProvenance_->fill(6,  iMu,   weight);
00989    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc!=0) GlbhitStaProvenance_->fill(7,  iMu,   weight);
00990   }
00991 
00992 
00993 
00994 
00995 
00996  //StandAlone track
00997   if(muon->isStandAloneMuon()){
00998    reco::Track const & StarecoTrack = *(muon->standAloneMuon());
00999    // hit counters
01000    int hitsFromDt=0;
01001    int hitsFromCsc=0;
01002    int hitsFromRpc=0;
01003    int hitsFromTk=0;
01004    int hitsFromTrack=0;
01005 //   int hitsFromSegmDt=0;
01006 //   int hitsFromSegmCsc=0;
01007    // segment counters
01008 //   int segmFromDt=0;
01009 //   int segmFromCsc=0;
01010 
01011    // hits from track
01012    for(trackingRecHit_iterator StarecHit =  StarecoTrack.recHitsBegin(); StarecHit != StarecoTrack.recHitsEnd(); ++StarecHit){
01013 
01014      hitsFromTrack++;
01015       DetId id = (*StarecHit)->geographicalId();
01016       // hits from DT
01017       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::DT )
01018         hitsFromDt++;
01019       // hits from CSC
01020        if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::CSC )
01021         hitsFromCsc++;
01022       // hits from RPC
01023       if (id.det() == DetId::Muon && id.subdetId() == MuonSubdetId::RPC )
01024         hitsFromRpc++;
01025       // hits from Tracker
01026       if (id.det() == DetId::Tracker){
01027         hitsFromTk++;
01028         if(id.subdetId() == PixelSubdetector::PixelBarrel )
01029           StahitTkrProvenance_->fill(1,  iMu,   weight);
01030         if(id.subdetId() == PixelSubdetector::PixelEndcap )
01031           StahitTkrProvenance_->fill(2,  iMu,   weight);
01032         if(id.subdetId() == SiStripDetId::TIB )
01033           StahitTkrProvenance_->fill(3,  iMu,   weight);
01034         if(id.subdetId() == SiStripDetId::TID )
01035           StahitTkrProvenance_->fill(4,  iMu,   weight);
01036         if(id.subdetId() == SiStripDetId::TOB )
01037           StahitTkrProvenance_->fill(5,  iMu,   weight);
01038         if(id.subdetId() == SiStripDetId::TEC )
01039           StahitTkrProvenance_->fill(6,  iMu,   weight);
01040       }
01041 
01042    }
01043 
01044    // fill the histos
01045 
01046 //   StahitsNotUsed_->fill(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack,  iMu,   weight);
01047 //   StahitsNotUsedPercentual_->fill(double(hitsFromSegmDt+hitsFromSegmCsc+hitsFromRpc+hitsFromTk-hitsFromTrack)/hitsFromTrack,  iMu,   weight);
01048 
01049    if(hitsFromDt!=0 && hitsFromCsc==0 && hitsFromRpc==0) StahitStaProvenance_->fill(1,  iMu,   weight);
01050    if(hitsFromCsc!=0 && hitsFromDt==0 && hitsFromRpc==0) StahitStaProvenance_->fill(2,  iMu,   weight);
01051    if(hitsFromRpc!=0 && hitsFromDt==0 && hitsFromCsc==0) StahitStaProvenance_->fill(3,  iMu,   weight);
01052    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc==0) StahitStaProvenance_->fill(4,  iMu,   weight);
01053    if(hitsFromDt!=0 && hitsFromRpc!=0 && hitsFromCsc==0) StahitStaProvenance_->fill(5,  iMu,   weight);
01054    if(hitsFromCsc!=0 && hitsFromRpc!=0 && hitsFromDt==0) StahitStaProvenance_->fill(6,  iMu,   weight);
01055    if(hitsFromDt!=0 && hitsFromCsc!=0 && hitsFromRpc!=0) StahitStaProvenance_->fill(7,  iMu,   weight);
01056   } 
01057 
01058 
01059 
01060 
01061 }
01062 
01063 void HistoMuon::fillCollection( const std::vector<Muon> & coll, double weight )
01064 {
01065 
01066   h_size_->fill( coll.size(), 1, weight );     
01067 
01068   std::vector<Muon>::const_iterator
01069     iobj = coll.begin(),
01070     iend = coll.end();
01071 
01072   uint i = 1;              
01073   for ( ; iobj != iend; ++iobj, ++i ) {
01074     fill( &*iobj, i, weight);      
01075   }
01076 }
01077 
01078 
01079 void HistoMuon::clearVec()
01080 {
01081   HistoGroup<Muon>::clearVec();
01082 
01083   h_trackIso_->clearVec();
01084   h_caloIso_->clearVec();
01085   h_leptonID_->clearVec();
01086   h_calCompat_->clearVec();
01087   h_caloE_->clearVec();
01088   h_type_->clearVec();
01089   h_nChambers_->clearVec();
01090   
01091 //muon energy deposit analyzer
01092   ecalDepEnergy_->clearVec();
01093   ecalS9DepEnergy_->clearVec();
01094   hcalDepEnergy_->clearVec();
01095   hcalS9DepEnergy_->clearVec();
01096   hoDepEnergy_->clearVec();
01097   hoS9DepEnergy_->clearVec();
01098 
01099 // muon reco  
01100   muReco_->clearVec(); 
01101   while(!etaGlbTrack_.empty())
01102     etaGlbTrack_.pop_back();
01103   while(!etaResolution_.empty())
01104     etaResolution_.pop_back();
01105   while(!thetaGlbTrack_.empty())
01106     thetaGlbTrack_.pop_back();
01107   while(!thetaResolution_.empty())
01108     thetaResolution_.pop_back();
01109   while(!phiGlbTrack_.empty())
01110     phiGlbTrack_.pop_back();
01111   while(!phiResolution_.empty())
01112     phiResolution_.pop_back();
01113   while(!pGlbTrack_.empty())
01114     pGlbTrack_.pop_back();
01115   while(!ptGlbTrack_.empty())
01116     ptGlbTrack_.pop_back();
01117   while(!qGlbTrack_.empty())
01118     qGlbTrack_.pop_back();
01119   while(!qOverpResolution_.empty())
01120     qOverpResolution_.pop_back();
01121   while(!qOverptResolution_.empty())
01122     qOverptResolution_.pop_back();
01123   while(!oneOverpResolution_.empty())
01124     oneOverpResolution_.pop_back();
01125   while(!oneOverptResolution_.empty())
01126     oneOverptResolution_.pop_back();
01127 
01128 // tracker muon
01129   etaTrack_->clearVec();
01130   thetaTrack_->clearVec();
01131   phiTrack_->clearVec();
01132   pTrack_->clearVec();
01133   ptTrack_->clearVec();
01134   qTrack_->clearVec();
01135 
01136 // sta muon
01137   etaStaTrack_->clearVec();
01138   thetaStaTrack_->clearVec();
01139   phiStaTrack_->clearVec();
01140   pStaTrack_->clearVec();
01141   ptStaTrack_->clearVec();
01142   qStaTrack_->clearVec();
01143 
01144 // segment track 
01145 
01146   GlbhitsNotUsed_->clearVec();
01147   GlbhitsNotUsedPercentual_->clearVec();
01148   GlbhitStaProvenance_->clearVec();
01149   GlbhitTkrProvenance_->clearVec();
01150 
01151   StahitsNotUsed_->clearVec();
01152   StahitsNotUsedPercentual_->clearVec();
01153   StahitStaProvenance_->clearVec();
01154   StahitTkrProvenance_->clearVec();
01155 
01156 /*
01157   TrackSegm_->clearVec();
01158   trackHitPercentualVsEta_->clearVec();
01159   trackHitPercentualVsPhi_->clearVec();
01160   trackHitPercentualVsPt_->clearVec();
01161   dtTrackHitPercentualVsEta_->clearVec();
01162   dtTrackHitPercentualVsPhi_->clearVec();
01163   dtTrackHitPercentualVsPt_->clearVec();
01164   cscTrackHitPercentualVsEta_->clearVec();
01165   cscTrackHitPercentualVsPhi_->clearVec();
01166   cscTrackHitPercentualVsPt_->clearVec();
01167 */
01168 
01169 }

Generated on Tue Jun 9 17:41:53 2009 for CMSSW by  doxygen 1.5.4