CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQMOffline/Muon/src/MuonEnergyDepositAnalyzer.cc

Go to the documentation of this file.
00001 
00002 /*
00003  *  See header file for a description of this class.
00004  *
00005  *  $Date: 2009/12/22 17:42:07 $
00006  *  $Revision: 1.15 $
00007  *  \author G. Mila - INFN Torino
00008  */
00009 
00010 #include "DQMOffline/Muon/src/MuonEnergyDepositAnalyzer.h"
00011 
00012 #include "DataFormats/Common/interface/Handle.h"
00013 #include "DataFormats/MuonReco/interface/Muon.h"
00014 #include "DataFormats/MuonReco/interface/MuonFwd.h" 
00015 #include "DataFormats/MuonReco/interface/MuonEnergy.h"
00016 
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018 
00019 #include "DataFormats/TrackReco/interface/Track.h"
00020 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00021 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00022 #include "TrackingTools/Records/interface/TransientTrackRecord.h"
00023 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00024 
00025 #include <cmath>
00026 #include <string>
00027 using namespace std;
00028 using namespace edm;
00029 
00030 
00031 
00032 MuonEnergyDepositAnalyzer::MuonEnergyDepositAnalyzer(const edm::ParameterSet& pSet, MuonServiceProxy *theService):MuonAnalyzerBase(theService) {
00033 
00034   parameters = pSet;
00035 }
00036 
00037 
00038 MuonEnergyDepositAnalyzer::~MuonEnergyDepositAnalyzer() { }
00039 
00040 
00041 void MuonEnergyDepositAnalyzer::beginJob( DQMStore * dbe) {
00042 
00043   metname = "muEnergyDepositAnalyzer";
00044 
00045   LogTrace(metname)<<"[MuonEnergyDepositAnalyzer] Parameters initialization";
00046   dbe->setCurrentFolder("Muons/MuonEnergyDepositAnalyzer");
00047   std::string AlgoName = parameters.getParameter<std::string>("AlgoName");
00048 
00049   emNoBin = parameters.getParameter<int>("emSizeBin");
00050   emNoMin = parameters.getParameter<double>("emSizeMin");
00051   emNoMax = parameters.getParameter<double>("emSizeMax");
00052   std::string histname = "ecalDepositedEnergyBarrel_";
00053   ecalDepEnergyBarrel = dbe->book1D(histname+AlgoName, "Energy deposited in the ECAL barrel cells", emNoBin, emNoMin, emNoMax);
00054   ecalDepEnergyBarrel->setAxisTitle("GeV");
00055   histname = "ecalDepositedEnergyEndcap_";
00056   ecalDepEnergyEndcap = dbe->book1D(histname+AlgoName, "Energy deposited in the ECAL endcap cells", emNoBin, emNoMin, emNoMax);
00057   ecalDepEnergyEndcap->setAxisTitle("GeV");
00058 
00059   emS9NoBin = parameters.getParameter<int>("emS9SizeBin");
00060   emS9NoMin = parameters.getParameter<double>("emS9SizeMin");
00061   emS9NoMax = parameters.getParameter<double>("emS9SizeMax");
00062   histname = "ecalS9DepositedEnergyBarrel_";
00063   ecalS9DepEnergyBarrel = dbe->book1D(histname+AlgoName, "Energy deposited in the ECAL barrel 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
00064   ecalS9DepEnergyBarrel->setAxisTitle("GeV");
00065   histname = "ecalS9DepositedEnergyEndcap_";
00066   ecalS9DepEnergyEndcap = dbe->book1D(histname+AlgoName, "Energy deposited in the ECAL endcap 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
00067   ecalS9DepEnergyEndcap->setAxisTitle("GeV");
00068   histname = "ecalS9PointingMuDepositedEnergy_Glb_";
00069   ecalS9PointingMuDepEnergy_Glb = dbe->book1D(histname+AlgoName, "Pointing glb muons energy deposited in the ECAL 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
00070   ecalS9PointingMuDepEnergy_Glb->setAxisTitle("GeV"); 
00071   histname = "ecalS9PointingMuDepositedEnergy_Tk_";
00072   ecalS9PointingMuDepEnergy_Tk = dbe->book1D(histname+AlgoName, "Pointing tk muons energy deposited in the ECAL 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
00073   ecalS9PointingMuDepEnergy_Tk->setAxisTitle("GeV"); 
00074   histname = "ecalS9PointingMuDepositedEnergy_Sta_";
00075   ecalS9PointingMuDepEnergy_Sta = dbe->book1D(histname+AlgoName, "Pointing sta muons energy deposited in the ECAL 3*3 towers", emS9NoBin, emS9NoMin, emS9NoMax);
00076   ecalS9PointingMuDepEnergy_Sta->setAxisTitle("GeV"); 
00077   
00078   hadNoBin = parameters.getParameter<int>("hadSizeBin");
00079   hadNoMin = parameters.getParameter<double>("hadSizeMin");
00080   hadNoMax = parameters.getParameter<double>("hadSizeMax");
00081   histname = "hadDepositedEnergyBarrel_";
00082   hcalDepEnergyBarrel = dbe->book1D(histname+AlgoName, "Energy deposited in the HCAL barrel cells", hadNoBin, hadNoMin, hadNoMax);
00083   hcalDepEnergyBarrel->setAxisTitle("GeV");
00084   histname = "hadDepositedEnergyEndcap_";
00085   hcalDepEnergyEndcap = dbe->book1D(histname+AlgoName, "Energy deposited in the HCAL endcap cells", hadNoBin, hadNoMin, hadNoMax);
00086   hcalDepEnergyEndcap->setAxisTitle("GeV");
00087  
00088   hadS9NoBin = parameters.getParameter<int>("hadS9SizeBin");
00089   hadS9NoMin = parameters.getParameter<double>("hadS9SizeMin");
00090   hadS9NoMax = parameters.getParameter<double>("hadS9SizeMax");
00091   histname = "hadS9DepositedEnergyBarrel_";
00092   hcalS9DepEnergyBarrel = dbe->book1D(histname+AlgoName, "Energy deposited in the HCAL barrel 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
00093   hcalS9DepEnergyBarrel->setAxisTitle("GeV");
00094   histname = "hadS9DepositedEnergyEndcap_";
00095   hcalS9DepEnergyEndcap = dbe->book1D(histname+AlgoName, "Energy deposited in the HCAL endcap 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
00096   hcalS9DepEnergyEndcap->setAxisTitle("GeV");
00097   histname = "hadS9PointingMuDepositedEnergy_Glb_";
00098   hcalS9PointingMuDepEnergy_Glb = dbe->book1D(histname+AlgoName, "Pointing glb muons energy deposited in the HCAL endcap 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
00099   hcalS9PointingMuDepEnergy_Glb->setAxisTitle("GeV");
00100   histname = "hadS9PointingMuDepositedEnergy_Tk_";
00101   hcalS9PointingMuDepEnergy_Tk = dbe->book1D(histname+AlgoName, "Pointing tk muons energy deposited in the HCAL endcap 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
00102   hcalS9PointingMuDepEnergy_Tk->setAxisTitle("GeV");
00103   histname = "hadS9PointingMuDepositedEnergy_Sta_";
00104   hcalS9PointingMuDepEnergy_Sta = dbe->book1D(histname+AlgoName, "Pointing sta muons energy deposited in the HCAL endcap 3*3 towers", hadS9NoBin, hadS9NoMin, hadS9NoMax);
00105   hcalS9PointingMuDepEnergy_Sta->setAxisTitle("GeV");
00106 
00107   hoNoBin = parameters.getParameter<int>("hoSizeBin");
00108   hoNoMin = parameters.getParameter<double>("hoSizeMin");
00109   hoNoMax = parameters.getParameter<double>("hoSizeMax");
00110   histname = "hoDepositedEnergy_";
00111   hoDepEnergy = dbe->book1D(histname+AlgoName, "Energy deposited in the HO cells", hoNoBin, hoNoMin, hoNoMax);
00112   hoDepEnergy->setAxisTitle("GeV");
00113 
00114   hoS9NoBin = parameters.getParameter<int>("hoS9SizeBin");
00115   hoS9NoMin = parameters.getParameter<double>("hoS9SizeMin");
00116   hoS9NoMax = parameters.getParameter<double>("hoS9SizeMax");
00117   histname = "hoS9DepositedEnergy_";
00118   hoS9DepEnergy = dbe->book1D(histname+AlgoName, "Energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
00119   hoS9DepEnergy->setAxisTitle("GeV");
00120   histname = "hoS9PointingMuDepositedEnergy_Glb_";
00121   hoS9PointingMuDepEnergy_Glb = dbe->book1D(histname+AlgoName, "Pointing glb muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
00122   hoS9PointingMuDepEnergy_Glb->setAxisTitle("GeV");
00123   histname = "hoS9PointingMuDepositedEnergy_Tk_";
00124   hoS9PointingMuDepEnergy_Tk = dbe->book1D(histname+AlgoName, "Pointing tk muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
00125   hoS9PointingMuDepEnergy_Tk->setAxisTitle("GeV");
00126   histname = "hoS9PointingMuDepositedEnergy_Sta_";
00127   hoS9PointingMuDepEnergy_Sta = dbe->book1D(histname+AlgoName, "Pointing sta muons energy deposited in the HO 3*3 towers", hoS9NoBin, hoS9NoMin, hoS9NoMax);
00128   hoS9PointingMuDepEnergy_Sta->setAxisTitle("GeV");
00129 
00130 }
00131 
00132 
00133 
00134 void MuonEnergyDepositAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup, const reco::Muon& recoMu) {
00135 
00136   LogTrace(metname)<<"[MuonEnergyDepositAnalyzer] Filling the histos";
00137 
00138   // get all the mu energy deposits
00139   reco::MuonEnergy muEnergy = recoMu.calEnergy();
00140   
00141   // energy deposited in ECAL
00142   LogTrace(metname) << "Energy deposited in ECAL: "<<muEnergy.em;
00143   if (fabs(recoMu.eta()) > 1.479) 
00144     ecalDepEnergyEndcap->Fill(muEnergy.em);
00145   else
00146     ecalDepEnergyBarrel->Fill(muEnergy.em);
00147 
00148   // energy deposited in HCAL
00149   LogTrace(metname) << "Energy deposited in HCAL: "<<muEnergy.had;
00150   if (fabs(recoMu.eta()) > 1.4)
00151     hcalDepEnergyEndcap->Fill(muEnergy.had);
00152   else
00153     hcalDepEnergyBarrel->Fill(muEnergy.had);
00154   
00155   // energy deposited in HO
00156   LogTrace(metname) << "Energy deposited in HO: "<<muEnergy.ho;
00157   if (fabs(recoMu.eta()) < 1.26)
00158     hoDepEnergy->Fill(muEnergy.ho);
00159   
00160   // energy deposited in ECAL in 3*3 towers
00161   LogTrace(metname) << "Energy deposited in ECAL: "<<muEnergy.emS9;
00162   if (fabs(recoMu.eta()) > 1.479) 
00163     ecalS9DepEnergyEndcap->Fill(muEnergy.emS9);
00164   else
00165     ecalS9DepEnergyBarrel->Fill(muEnergy.emS9);
00166      
00167   // energy deposited in HCAL in 3*3 crystals
00168   LogTrace(metname) << "Energy deposited in HCAL: "<<muEnergy.hadS9;
00169   if (fabs(recoMu.eta()) > 1.4)
00170     hcalS9DepEnergyEndcap->Fill(muEnergy.hadS9);
00171   else
00172     hcalS9DepEnergyBarrel->Fill(muEnergy.hadS9);
00173   
00174   // energy deposited in HO in 3*3 crystals
00175   LogTrace(metname) << "Energy deposited in HO: "<<muEnergy.hoS9;
00176   if (fabs(recoMu.eta()) < 1.26)
00177     hoS9DepEnergy->Fill(muEnergy.hoS9);
00178   
00179   // plot for energy tests
00180   edm::ESHandle<TransientTrackBuilder> theB;
00181   iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder",theB);
00182   reco::TransientTrack TransTrack;
00183   
00184   if(recoMu.isGlobalMuon())
00185     TransTrack = theB->build(recoMu.globalTrack());
00186   if(recoMu.isTrackerMuon() && !(recoMu.isGlobalMuon()))
00187     TransTrack = theB->build(recoMu.innerTrack());
00188   if(recoMu.isStandAloneMuon() && !(recoMu.isGlobalMuon()))
00189     TransTrack = theB->build(recoMu.outerTrack());
00190 
00191   TrajectoryStateOnSurface TSOS;
00192   TSOS = TransTrack.impactPointState();
00193   // section for vertex pointing muon
00194   if((abs(TSOS.globalPosition().z())<30) && (abs(TSOS.globalPosition().perp())<20)){
00195     // GLB muon
00196     if(recoMu.isGlobalMuon()){
00197       ecalS9PointingMuDepEnergy_Glb->Fill(muEnergy.emS9);
00198       hcalS9PointingMuDepEnergy_Glb->Fill(muEnergy.hadS9);
00199       hoS9PointingMuDepEnergy_Glb->Fill(muEnergy.hoS9);
00200     }
00201     // TK muon
00202     if(recoMu.isTrackerMuon() && !(recoMu.isGlobalMuon())){
00203       ecalS9PointingMuDepEnergy_Tk->Fill(muEnergy.emS9);
00204       hcalS9PointingMuDepEnergy_Tk->Fill(muEnergy.hadS9);
00205       hoS9PointingMuDepEnergy_Tk->Fill(muEnergy.hoS9);
00206     }
00207     // STA muon
00208     if(recoMu.isStandAloneMuon() && !(recoMu.isGlobalMuon())){
00209       ecalS9PointingMuDepEnergy_Sta->Fill(muEnergy.emS9);
00210       hcalS9PointingMuDepEnergy_Sta->Fill(muEnergy.hadS9);
00211       hoS9PointingMuDepEnergy_Sta->Fill(muEnergy.hoS9);
00212     } 
00213   }
00214 
00215 }
00216 
00217