CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DQM/HLTEvF/plugins/HLTMuonDQMSource.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    HLTMuonDQMSource
00004 // Class:      HLTMuonDQMSource
00005 // 
00013 //
00014 // Original Author:  Muriel VANDER DONCKT *:0
00015 //         Created:  Wed Dec 12 09:55:42 CET 2007
00016 // $Id: HLTMuonDQMSource.cc,v 1.43 2011/03/29 14:19:52 hdyoo Exp $
00017 // Modification:  Sanghyeon Song (Chonnam National University)
00018 // contact: sanghyeon.song@cern.ch
00019 //
00020 //
00021 
00022 
00023 
00024 #include "DQM/HLTEvF/interface/HLTMuonDQMSource.h"
00025 #include "DQMServices/Core/interface/DQMStore.h"
00026 
00027 #include "DataFormats/Common/interface/Handle.h"
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/EventSetup.h"
00030 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00031 #include "FWCore/ServiceRegistry/interface/Service.h"
00032 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
00033 #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h"
00034 #include "DataFormats/TrackReco/interface/Track.h"
00035 
00036 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
00037 
00038 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00039 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
00040 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
00041 #include "DataFormats/Common/interface/AssociationMap.h"
00042 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00043 #include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeed.h"
00044 #include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeedCollection.h"
00045 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
00046 #include "DataFormats/L1Trigger/interface/L1MuonParticle.h"
00047 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
00048 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h"
00049 
00050 #include "DataFormats/MuonSeed/interface/L3MuonTrajectorySeed.h"
00051 #include "DataFormats/MuonSeed/interface/L3MuonTrajectorySeedCollection.h"
00052 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
00053 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00054 #include "DataFormats/Common/interface/TriggerResults.h"
00055 #include "FWCore/Common/interface/TriggerNames.h"
00056 
00057 #include "DataFormats/CaloTowers/interface/CaloTower.h"
00058 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00059 #include "FWCore/Framework/interface/ESHandle.h"
00060 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00061 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00062 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
00063 #include "MagneticField/Engine/interface/MagneticField.h"
00064 
00065 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00066 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00067 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00068 
00069 #include "DataFormats/Math/interface/deltaR.h"
00070 
00071 #include "TMath.h" 
00072 
00073 
00074 //using namespace std;
00075 //using namespace edm;
00076 //using namespace reco;
00077 //using namespace l1extra;
00078 //
00079 // constructors and destructor
00080 //
00081 HLTMuonDQMSource::HLTMuonDQMSource( const edm::ParameterSet& ps ) :counterEvt_(0), nTrig_(0)
00082 {
00083   parameters_ = ps;
00084   verbose_ = parameters_.getUntrackedParameter < bool > ("verbose", false);
00085   monitorName_ = parameters_.getUntrackedParameter<std::string>("monitorName","HLT/HLTMonMuon");
00086   prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
00087   coneSize_ = parameters_.getUntrackedParameter<double>("coneSize", 0.24);
00088   l2seedscollectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l2MuonSeedTag",edm::InputTag("hltL2MuonSeeds"));
00089   l3seedscollectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonSeedTag",edm::InputTag("hltL3TrajectorySeed"));
00090   l2collectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l2MuonTag",edm::InputTag("hltL2MuonCandidates"));
00091   l3collectionTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTag",edm::InputTag("hltL3MuonCandidates"));
00092   l2isolationTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l2IsolationTag",edm::InputTag("hltL2MuonIsolations"));
00093   l3isolationTag_ = parameters_.getUntrackedParameter<edm::InputTag>("l3IsolationTag",edm::InputTag("hltL3MuonIsolations"));
00094 
00095   TrigResultInput = parameters_.getUntrackedParameter<edm::InputTag>("TrigResultInputTag", edm::InputTag("TriggerResults"));
00096 
00097 
00098   l3seedscollectionTagOIState_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonSeedTagOIState",edm::InputTag("hltL3TrajSeedOIState"));
00099   l3seedscollectionTagOIHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonSeedTagOIHit",edm::InputTag("hltL3TrajSeedOIHit"));
00100   l3seedscollectionTagIOHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonSeedTagIOHit",edm::InputTag("hltL3TrajSeedIOHit"));
00101 
00102   l3trkfindingOIState_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrkFindingOIState",edm::InputTag("hltL3TrackCandidateFromL2OIState"));
00103   l3trkfindingOIHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrkFindingOIHit",edm::InputTag("hltL3TrackCandidateFromL2OIHit"));
00104   l3trkfindingIOHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrkFindingIOHit",edm::InputTag("hltL3TrackCandidateFromL2IOHit"));
00105 
00106   l3trkOIState_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrkOIState",edm::InputTag("hltL3TkTracksFromL2OIState"));
00107   l3trkOIHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrkOIHit",edm::InputTag("hltL3TkTracksFromL2OIHit"));
00108   l3trkIOHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrkIOHit",edm::InputTag("hltL3TkTracksFromL2IOHit"));
00109   l3tktrk_ = parameters_.getUntrackedParameter<edm::InputTag>("l3MuonTrk",edm::InputTag("hltL3TkTracksFromL2"));
00110 
00111   l3muons_ = parameters_.getUntrackedParameter<edm::InputTag>("l3muons",edm::InputTag("hltL3Muons"));
00112   l3muonsOIState_ = parameters_.getUntrackedParameter<edm::InputTag>("l3muonsOIState",edm::InputTag("hltL3MuonsOIState"));
00113   l3muonsOIHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3muonsOIHit",edm::InputTag("hltL3MuonsOIHit"));
00114   l3muonsIOHit_ = parameters_.getUntrackedParameter<edm::InputTag>("l3muonsIOHit",edm::InputTag("hltL3MuonsIOHit"));
00115 
00116   dbe_ = 0 ;
00117   dbe_ = edm::Service < DQMStore > ().operator->();
00118   dbe_->setVerbose(0);
00119 
00120   outputFile_ =
00121     parameters_.getUntrackedParameter < std::string > ("outputFile", "");
00122   if (outputFile_.size() != 0) {
00123     edm::LogWarning("HLTMuonDQMSource") << "Muon HLT Monitoring histograms will be saved to " 
00124       << outputFile_ << std::endl;
00125   }
00126   else {
00127     outputFile_ = "HLTMuonDQM.root";
00128   }
00129 
00130   bool disable =
00131     parameters_.getUntrackedParameter < bool > ("disableROOToutput", false);
00132   if (disable) {
00133     outputFile_ = "";
00134   }
00135 
00136   if (dbe_ != NULL) {
00137     dbe_->setCurrentFolder(monitorName_);
00138   }
00139 
00140   std::vector<edm::ParameterSet> filters = parameters_.getParameter<std::vector<edm::ParameterSet> >("filters");
00141 
00142   for(std::vector<edm::ParameterSet>::iterator filterconf = filters.begin() ; filterconf != filters.end() ; filterconf++){
00143     theDirectoryName.push_back(filterconf->getParameter<std::string>("directoryName"));
00144     //theHLTCollectionLevel.push_back(filterconf->getParameter<std::string>("level"));
00145     //theTriggerBits.push_back(filterconf->getParameter<std::vector<std::string> >("triggerBits"));
00146     std::string _tmp_level = filterconf->getParameter<std::string>("directoryName");
00147     std::vector<std::string> _tmp_bits = filterconf->getParameter<std::vector<std::string> >("triggerBits");
00148     for( size_t i = 0; i < _tmp_bits.size(); ++i ) {
00149       theTriggerBits.push_back(_tmp_bits[i]);
00150       theHLTCollectionLevel.push_back(_tmp_level);
00151     }
00152   }
00153 
00154   // L1PassThrough, L2PassThrough, L3PassThrough
00155   nTrigs = theDirectoryName.size();
00156 
00157   for( int trig = 0; trig < nTrigs; trig++ ) striggers_[trig] = "";
00158 }
00159 
00160 
00161 HLTMuonDQMSource::~HLTMuonDQMSource()
00162 {
00163 
00164   // do anything here that needs to be done at desctruction time
00165   // (e.g. close files, deallocate resources etc.)
00166 
00167 }
00168 
00169 
00170 //--------------------------------------------------------
00171 void HLTMuonDQMSource::beginJob()
00172 {
00173   if (dbe_) {
00174     //dbe_->setCurrentFolder("monitorName_");
00175     if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
00176     edm::LogInfo("HLTMuonDQMSource") << "===>DQM event prescale = " << prescaleEvt_ << " events "<< std::endl;
00177 
00178 
00180     int NBINS = 50; XMIN = 0; XMAX = 50;
00181 
00182     // create and cd into new folder
00183     char name[512], title[512];
00184     double pt_max;
00185     std::string dirname;
00186 
00187     for( int trig = 0; trig < nTrigs; trig++ ) {
00188       dirname = theDirectoryName[trig]+"/";
00189 
00190       for(unsigned int i = 0; i < theHLTCollectionLevel.size(); ++i){
00191         if(theHLTCollectionLevel[i] == theDirectoryName[trig]) {
00192           if(!strcmp(striggers_[trig].c_str(), "")) striggers_[trig] = theTriggerBits[i];
00193           else striggers_[trig] += ", " + theTriggerBits[i];
00194         }
00195       }
00196       dbe_->setCurrentFolder(monitorName_ + dirname);
00197       sprintf(name,"%s triggers",theDirectoryName[trig].c_str());
00198       dbe_->bookString(name,striggers_[trig]);
00199 
00200       for ( int level = 1; level < 7; ++level ) {
00201         if( level < 4 ) sprintf(name,"Level%i",level);
00202         else if (level == 4 ) sprintf(name,"Level%iSeed", level-2);
00203         else if (level == 5 ) sprintf(name,"Level%iSeed", level-2);
00204         else if (level == 6 ) sprintf(name,"Isolation");
00205 
00206         if( level == 1 ) pt_max = 145;
00207         else pt_max = 200;
00208         dbe_->setCurrentFolder(monitorName_+dirname+name);
00209         if( level == 1 ) hl1quality[trig] = dbe_->book1D("h1L1Quality","GMT quality Flag", 8, 0., 8.);
00210         if( level == 2 ) {
00211           hnHits[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 100.);
00212           hnValidHits[trig] = dbe_->book1D("HLTMuonL2_nValidHits", "L2 Number of Valid Hits", NBINS, 0., 100.);
00213           hnValidHits[trig]->setAxisTitle("Number of Valid Hits", 1);
00214         }
00215         if( level == 3 ) {
00216 
00217           hnTkValidHits[trig] = dbe_->book1D("HLTMuonL3_nTkValidHits", "L3 Number of Valid Tracker Hits", 30, 0., 30.);
00218           hnTkValidHits[trig]->setAxisTitle("Number of Valid Tracker Hits", 1);
00219           hnPixelValidHits[trig] = dbe_->book1D("HLTMuonL3_nPixelValidHits", "L3 Number of Valid Pixel Hits", 10, 0., 10.);
00220           hnPixelValidHits[trig]->setAxisTitle("Number of Valid Pixel Hits", 1);
00221           hnStripValidHits[trig] = dbe_->book1D("HLTMuonL3_nStripValidHits", "L3 Number of Valid Strip Hits", 20, 0., 20.);
00222           hnStripValidHits[trig]->setAxisTitle("Number of Valid Strip Hits", 1);
00223           hnMuValidHits[trig] = dbe_->book1D("HLTMuonL3_nMuValidHits", "L3 Number of Valid Muon Hits", 100, 0., 100.);
00224           hnMuValidHits[trig]->setAxisTitle("Number of Valid Muon Hits", 1);
00225         }
00226         if( level == 1 ) {
00227           int eta_nbin = 62;
00228           float eta_bins[63] = {
00229             -2.40, -2.35, -2.30, -2.25, -2.20, -2.15, -2.10, -2.05,
00230             -2.00, -1.95, -1.90, -1.85, -1.80, -1.75, -1.70, -1.60,
00231             -1.50, -1.40, -1.30, -1.20, -1.10, -1.00, -0.90, -0.80,
00232             -0.70, -0.60, -0.50, -0.40, -0.30, -0.20, -0.10, -0.00,
00233             0.10,  0.20,  0.30,  0.40,  0.50,  0.60,  0.70,  0.80,
00234             0.90,  1.00,  1.10,  1.20,  1.30,  1.40,  1.50,  1.60,
00235             1.70,  1.75,  1.80,  1.85,  1.90,  1.95,  2.00,  2.05,
00236             2.10,  2.15,  2.20,  2.25,  2.30,  2.35,  2.40
00237           };
00238           int phi_nbin = 144;            
00239           float phi_bins[145];
00240           for( int ibin = 0; ibin < 145; ibin++ ) {
00241             phi_bins[ibin] = -3.15 + (ibin)*(6.30/144);
00242           }
00243           float pt_bins[51];
00244           for( int ibin = 0; ibin < 51; ibin++ ) {
00245             pt_bins[ibin] = ibin*(145./50.);
00246           }
00247           sprintf(name,"HLTMuonL%i_NMu",level);
00248           sprintf(title,"L%i number of muons",level);
00249           hNMu[trig][level-1] = dbe_->book1D(name,title, 11, -0.5, 10.5);
00250           hNMu[trig][level-1]->setAxisTitle("Number of muons", 1);
00251           sprintf(name,"HLTMuonL%i_pt",level);
00252           sprintf(title,"L%i Pt",level);
00253           hpt[trig][level-1] = dbe_->book1D(name,title, NBINS, pt_bins);
00254           hpt[trig][level-1]->setAxisTitle("Pt", 1);
00255           sprintf(name,"HLTMuonL%i_eta",level);
00256           sprintf(title,"L%i Muon #eta",level);
00257           heta[trig][level-1] = dbe_->book1D(name,title, eta_nbin, eta_bins);
00258           heta[trig][level-1]->setAxisTitle("#eta", 1);
00259           sprintf(name,"HLTMuonL%i_phi",level);
00260           sprintf(title,"L%i Muon #phi",level);
00261           hphi[trig][level-1] = dbe_->book1D(name,title, phi_nbin, phi_bins);
00262           hphi[trig][level-1]->setAxisTitle("#phi", 1);
00263 
00264           sprintf(name,"HLTMuonL%i_phi_norm",level);
00265           sprintf(title,"L%i Muon #phi_norm",level);
00266           hphi_norm[trig][level-1] = dbe_->book1D(name,title, phi_nbin, phi_bins);
00267           hphi_norm[trig][level-1]->setAxisTitle("#phi", 1);
00268           sprintf(name,"HLTMuonL%i_etaphi",level);
00269           sprintf(title,"L%i Muon #eta vs #phi",level);
00270           hetaphi[trig][level-1] = dbe_->book2D(name,title, phi_nbin, phi_bins, eta_nbin, eta_bins);
00271           hetaphi[trig][level-1]->setAxisTitle("#phi", 1);
00272           hetaphi[trig][level-1]->setAxisTitle("#eta", 2); 
00273           sprintf(name,"HLTMuonL%i_ptphi",level);
00274           sprintf(title,"L%i Muon pt vs #phi",level);         
00275           hptphi[trig][level-1] = dbe_->book2D(name,title, NBINS, pt_bins, phi_nbin, phi_bins);
00276           hptphi[trig][level-1]->setAxisTitle("pt", 1);
00277           hptphi[trig][level-1]->setAxisTitle("#phi", 2);
00278           sprintf(name,"HLTMuonL%i_pteta",level);
00279           sprintf(title,"L%i Muon pt vs #eta",level);         
00280           hpteta[trig][level-1] = dbe_->book2D(name,title, NBINS, pt_bins, eta_nbin, eta_bins);
00281           hpteta[trig][level-1]->setAxisTitle("pt", 1);
00282           hpteta[trig][level-1]->setAxisTitle("#eta", 2);
00283           sprintf(name,"HLTMuonL%i_charge",level);
00284           sprintf(title,"L%i Muon Charge",level);         
00285           hcharge[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00286           hcharge[trig][level-1]->setAxisTitle("Charge", 1);
00287 
00288         }
00289         if( level > 1 && level < 4 ) {
00290           sprintf(name,"HLTMuonL%i_NMu",level);
00291           sprintf(title,"L%i number of muons",level);
00292           hNMu[trig][level-1] = dbe_->book1D(name,title,11, -0.5, 10.5);
00293           hNMu[trig][level-1]->setAxisTitle("Number of muons", 1);
00294           sprintf(name,"HLTMuonL%i_pt",level);
00295           sprintf(title,"L%i Pt",level);
00296           hpt[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
00297           hpt[trig][level-1]->setAxisTitle("Pt", 1);
00298           sprintf(name,"HLTMuonL%i_eta",level);
00299           sprintf(title,"L%i Muon #eta",level);
00300           heta[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00301           heta[trig][level-1]->setAxisTitle("#eta", 1);
00302           sprintf(name,"HLTMuonL%i_phi",level);
00303           sprintf(title,"L%i Muon #phi",level);
00304           hphi[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00305           hphi[trig][level-1]->setAxisTitle("#phi", 1);
00306 
00307           sprintf(name,"HLTMuonL%i_phi_norm",level);
00308           sprintf(title,"L%i Muon #phi_norm",level);
00309           hphi_norm[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00310           hphi_norm[trig][level-1]->setAxisTitle("#phi", 1);
00311           sprintf(name,"HLTMuonL%i_etaphi",level);
00312           sprintf(title,"L%i Muon #eta vs #phi",level);
00313           hetaphi[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15,NBINS,-2.5, 2.5);
00314           hetaphi[trig][level-1]->setAxisTitle("#phi", 1);
00315           hetaphi[trig][level-1]->setAxisTitle("#eta", 2); 
00316           sprintf(name,"HLTMuonL%i_ptphi",level);
00317           sprintf(title,"L%i Muon pt vs #phi",level);         
00318           hptphi[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-3.15, 3.15);
00319           hptphi[trig][level-1]->setAxisTitle("pt", 1);
00320           hptphi[trig][level-1]->setAxisTitle("#phi", 2);
00321           sprintf(name,"HLTMuonL%i_pteta",level);
00322           sprintf(title,"L%i Muon pt vs #eta",level);         
00323           hpteta[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-2.5, 2.5);
00324           hpteta[trig][level-1]->setAxisTitle("pt", 1);
00325           hpteta[trig][level-1]->setAxisTitle("#eta", 2);
00326           sprintf(name,"HLTMuonL%i_nHits",level);
00327           sprintf(title,"L%i Number of Hits",level);         
00328           hnHits[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 100.);
00329           hnHits[trig][level-1]->setAxisTitle("Number of Hits", 1);
00330           sprintf(name,"HLTMuonL%i_charge",level);
00331           sprintf(title,"L%i Muon Charge",level);         
00332           hcharge[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00333           hcharge[trig][level-1]->setAxisTitle("Charge", 1);
00334 
00335 
00336         }
00337         else if( level == 4 || level == 5 ) {
00338           sprintf(name,"HLTMuonL%iSeed_NMu",level-2);
00339           sprintf(title,"L%iSeed number of muons",level-2);
00340           hNMu[trig][level-1] = dbe_->book1D(name,title, 11, -0.5, 10.5);
00341           hNMu[trig][level-1]->setAxisTitle("Number of muons", 1);
00342           sprintf(name,"HLTMuonL%iSeed_pt",level-2);
00343           sprintf(title,"L%iSeed Pt",level-2);
00344           hpt[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
00345           hpt[trig][level-1]->setAxisTitle("Pt", 1);
00346           sprintf(name,"HLTMuonL%iSeed_eta",level-2);
00347           sprintf(title,"L%iSeed Muon #eta",level-2);
00348           heta[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00349           heta[trig][level-1]->setAxisTitle("#eta", 1);
00350           sprintf(name,"HLTMuonL%iSeed_phi",level-2);
00351           sprintf(title,"L%iSeed Muon #phi",level-2);
00352           hphi[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00353           hphi[trig][level-1]->setAxisTitle("#phi", 1);
00354 
00355           sprintf(name,"HLTMuonL%iSeed_etaphi",level-2);
00356           sprintf(title,"L%iSeed Muon #eta vs #phi",level-2);
00357           hetaphi[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15,NBINS,-2.5, 2.5);
00358           hetaphi[trig][level-1]->setAxisTitle("#phi", 1);
00359           hetaphi[trig][level-1]->setAxisTitle("#eta", 2); 
00360           sprintf(name,"HLTMuonL%iSeed_ptphi",level-2);
00361           sprintf(title,"L%iSeed Muon pt vs #phi",level-2);         
00362           hptphi[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-3.15, 3.15);
00363           hptphi[trig][level-1]->setAxisTitle("pt", 1);
00364           hptphi[trig][level-1]->setAxisTitle("#phi", 2);
00365           sprintf(name,"HLTMuonL%iSeed_pteta",level-2);
00366           sprintf(title,"L%iSeed Muon pt vs #eta",level-2);         
00367           hpteta[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max,NBINS,-2.5, 2.5);
00368           hpteta[trig][level-1]->setAxisTitle("pt", 1);
00369           hpteta[trig][level-1]->setAxisTitle("#eta", 2);
00370           sprintf(name,"HLTMuonL%iSeed_charge",level-2);
00371           sprintf(title,"L%iSeed Muon Charge",level-2);         
00372           hcharge[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00373           hcharge[trig][level-1]->setAxisTitle("Charge", 1);
00374           // pt
00375           sprintf(name,"HLTMuonL%iSeedtoL%i_ptres",level-2,level-3);
00376           sprintf(title,"L%iSeed1/Pt - L%iMuon1/Pt",level-2,level-3);         
00377           hseedptres[trig][level-4] = dbe_->book1D(name,title, NBINS, -0.1, 0.1);
00378           sprintf(title,"1/PtL%iSeed - 1/PtL%i",level-2,level-3);         
00379           hseedptres[trig][level-4]->setAxisTitle(title, 1);
00380           sprintf(name,"HLTMuonL%iSeedtoL%i_ptrelres",level-2,level-3);
00381           sprintf(title,"(L%iSeed1/Pt - L%iMuon1/Pt)/(L%iMuon1/Pt)",level-2,level-3,level-3);         
00382           hseedptrelres[trig][level-4] = dbe_->book1D(name,title, NBINS, -1.0, 1.0);
00383           sprintf(title,"(1/PtL%iSeed - 1/PtL%i)/(1/PtL%i)",level-2,level-3,level-3);         
00384           hseedptrelres[trig][level-4]->setAxisTitle(title, 1);
00385           // eta
00386           sprintf(name,"HLTMuonL%iSeedtoL%i_etares",level-2,level-3);
00387           sprintf(title,"L%iSeed#eta - L%iMuon#eta",level-2,level-3);         
00388           hseedetares[trig][level-4] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
00389           sprintf(title,"L%iSeed #eta - L%i #eta",level-2,level-3);         
00390           hseedetares[trig][level-4]->setAxisTitle(title, 1);
00391           sprintf(name,"HLTMuonL%iSeedtoL%i_etarelres",level-2,level-3);
00392           sprintf(title,"(L%iSeed#eta - L%iMuon#eta)/L%iMuon#eta",level-2,level-3,level-3);         
00393           hseedetarelres[trig][level-4] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
00394           sprintf(title,"(L%iSeed #eta - L%i #eta)/L%i #eta",level-2,level-3,level-3);         
00395           hseedetarelres[trig][level-4]->setAxisTitle(title, 1);
00396           // phi
00397           sprintf(name,"HLTMuonL%iSeedtoL%i_phires",level-2,level-3);
00398           sprintf(title,"L%iSeed#phi - L%iMuon#phi",level-2,level-3);         
00399           hseedphires[trig][level-4] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
00400           sprintf(title,"L%iSeed #phi - L%i #phi",level-2,level-3);         
00401           hseedphires[trig][level-4]->setAxisTitle(title, 1);
00402           sprintf(name,"HLTMuonL%iSeedtoL%i_phirelres",level-2,level-3);
00403           sprintf(title,"(L%iSeed#phi - L%iMuon#phi)/L%iMuon#phi",level-2,level-3,level-3);         
00404           hseedphirelres[trig][level-4] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
00405           sprintf(title,"(L%iSeed #phi - L%i #phi)/L%i #phi",level-2,level-3,level-3);         
00406           hseedphirelres[trig][level-4]->setAxisTitle(title, 1);
00407 
00408           sprintf(name,"HLTMuonL%iSeed_NMuperL%i",level-2,level-3);
00409           sprintf(title,"L%iSeedNMu per L%i",level-2,level-3);         
00410           hseedNMuper[trig][level-4] = dbe_->book1D(name, title, 5, -0.5, 4.5);
00411           hseedNMuper[trig][level-4]->setAxisTitle(title, 1);
00412 
00413           if( level == 5 ){
00414             dbe_->setCurrentFolder(monitorName_+dirname+"Level3Seed");
00415 
00416             sprintf(name,"HLTMuonL3Seed_NMu_comp");
00417             sprintf(title,"Comparison of each HLT L3 Muon Seed");
00418             hNMu_l3seed_comp[trig][level-1] = dbe_->book1D(name,title,4,0,4);
00419             hNMu_l3seed_comp[trig][level-1]->setAxisTitle("Number of muons",1);
00420             hNMu_l3seed_comp[trig][level-1]->setBinLabel(1, "Cascade", 1);
00421             hNMu_l3seed_comp[trig][level-1]->setBinLabel(2, "OIState", 1);
00422             hNMu_l3seed_comp[trig][level-1]->setBinLabel(3, "OIHit", 1);
00423             hNMu_l3seed_comp[trig][level-1]->setBinLabel(4, "IOHit", 1);
00424 
00425             dbe_->setCurrentFolder(monitorName_+dirname+"Level3Seed/OIState");
00426 
00427             sprintf(name,"HLTMuonL%iSeed_NMu_OIState",level-2);
00428             sprintf(title,"OIState L%iSeed number of muons",level-2);
00429             hNMu_OIState[trig][level-1] = dbe_->book1D(name,title, 11, -0.5, 10.5);
00430             hNMu_OIState[trig][level-1]->setAxisTitle("Number of muons", 1);
00431             sprintf(name,"HLTMuonL%iSeed_pt_OIState",level-2);
00432             sprintf(title,"L%iSeed OIState Muon Pt",level-2);
00433             hpt_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
00434             hpt_OIState[trig][level-1]->setAxisTitle("Pt", 1);
00435             sprintf(name,"HLTMuonL%iSeed_eta_OIState",level-2);
00436             sprintf(title,"L%iSeed OIState Muon #eta",level-2);
00437             heta_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00438             heta_OIState[trig][level-1]->setAxisTitle("#eta", 1);
00439             sprintf(name,"HLTMuonL%iSeed_phi_OIState",level-2);
00440             sprintf(title,"L%iSeed OIState Muon #phi",level-2);
00441             hphi_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00442             hphi_OIState[trig][level-1]->setAxisTitle("#phi", 1);
00443             sprintf(name,"HLTMuonL%iSeed_etaphi_OIState",level-2);
00444             sprintf(title,"L%iSeed OIState Muon #eta vs #phi",level-2);
00445             hetaphi_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00446             hetaphi_OIState[trig][level-1]->setAxisTitle("#phi", 1);
00447             hetaphi_OIState[trig][level-1]->setAxisTitle("#eta", 2);
00448             sprintf(name,"HLTMuonL%iSeed_ptphi_OIState",level-2);
00449             sprintf(title,"L%iSeed OIState Muon pt vs #phi",level-2);
00450             hptphi_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max, NBINS, -3.15, 3.15);
00451             hptphi_OIState[trig][level-1]->setAxisTitle("pt", 1);
00452             hptphi_OIState[trig][level-1]->setAxisTitle("#phi", 2);
00453             sprintf(name,"HLTMuonL%iSeed_pteta_OIState",level-2);
00454             sprintf(title,"L%iSeed OIState Muon pt vs #eta",level-2);
00455             hpteta_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max, NBINS, -2.5, 2.5);
00456             hpteta_OIState[trig][level-1]->setAxisTitle("pt", 1);
00457             hpteta_OIState[trig][level-1]->setAxisTitle("#eta", 2);
00458             sprintf(name,"HLTMuonL%iSeed_charge_OIState",level-2);
00459             sprintf(title,"L%iSeed OIState Muon Charge",level-2);
00460             hcharge_OIState[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00461             hcharge_OIState[trig][level-1]->setAxisTitle("Charge", 1);
00462 
00463             dbe_->setCurrentFolder(monitorName_+dirname+"Level3Seed/OIHit");
00464 
00465             sprintf(name,"HLTMuonL%iSeed_NMu_OIHit",level-2);
00466             sprintf(title,"OIHit L%iSeed number of muons",level-2);
00467             hNMu_OIHit[trig][level-1] = dbe_->book1D(name,title, 11, -0.5, 10.5);
00468             hNMu_OIHit[trig][level-1]->setAxisTitle("Number of muons", 1);
00469             sprintf(name,"HLTMuonL%iSeed_pt_OIHit",level-2);
00470             sprintf(title,"L%iSeed OIHit Muon Pt",level-2);
00471             hpt_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
00472             hpt_OIHit[trig][level-1]->setAxisTitle("Pt", 1);
00473             sprintf(name,"HLTMuonL%iSeed_eta_OIHit",level-2);
00474             sprintf(title,"L%iSeed OIHit Muon #eta",level-2);
00475             heta_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00476             heta_OIHit[trig][level-1]->setAxisTitle("#eta", 1);
00477             sprintf(name,"HLTMuonL%iSeed_phi_OIHit",level-2);
00478             sprintf(title,"L%iSeed OIHit Muon #phi",level-2);
00479             hphi_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00480             hphi_OIHit[trig][level-1]->setAxisTitle("#phi", 1);
00481             sprintf(name,"HLTMuonL%iSeed_etaphi_OIHit",level-2);
00482             sprintf(title,"L%iSeed OIHit Muon #eta vs #phi",level-2);
00483             hetaphi_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00484             hetaphi_OIHit[trig][level-1]->setAxisTitle("#phi", 1);
00485             hetaphi_OIHit[trig][level-1]->setAxisTitle("#eta", 2);
00486             sprintf(name,"HLTMuonL%iSeed_ptphi_OIHit",level-2);
00487             sprintf(title,"L%iSeed OIHit Muon pt vs #phi",level-2);
00488             hptphi_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max, NBINS, -3.15, 3.15);
00489             hptphi_OIHit[trig][level-1]->setAxisTitle("pt", 1);
00490             hptphi_OIHit[trig][level-1]->setAxisTitle("#phi", 2);
00491             sprintf(name,"HLTMuonL%iSeed_pteta_OIHit",level-2);
00492             sprintf(title,"L%iSeed OIHit Muon pt vs #eta",level-2);
00493             hpteta_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max, NBINS, -2.5, 2.5);
00494             hpteta_OIHit[trig][level-1]->setAxisTitle("pt", 1);
00495             hpteta_OIHit[trig][level-1]->setAxisTitle("#eta", 2);
00496             sprintf(name,"HLTMuonL%iSeed_charge_OIHit",level-2);
00497             sprintf(title,"L%iSeed OIHit Muon Charge",level-2);
00498             hcharge_OIHit[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00499             hcharge_OIHit[trig][level-1]->setAxisTitle("Charge", 1);
00500 
00501             dbe_->setCurrentFolder(monitorName_+dirname+"Level3Seed/IOHit");
00502 
00503             sprintf(name,"HLTMuonL%iSeed_NMu_IOHit",level-2);
00504             sprintf(title,"IOHit L%iSeed number of muons",level-2);
00505             hNMu_IOHit[trig][level-1] = dbe_->book1D(name,title, 11, -0.5, 10.5);
00506             hNMu_IOHit[trig][level-1]->setAxisTitle("Number of muons", 1);
00507             sprintf(name,"HLTMuonL%iSeed_pt_IOHit",level-2);
00508             sprintf(title,"L%iSeed IOHit Muon Pt",level-2);
00509             hpt_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., pt_max);
00510             hpt_IOHit[trig][level-1]->setAxisTitle("Pt", 1);
00511             sprintf(name,"HLTMuonL%iSeed_eta_IOHit",level-2);
00512             sprintf(title,"L%iSeed IOHit Muon #eta",level-2);
00513             heta_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00514             heta_IOHit[trig][level-1]->setAxisTitle("#eta", 1);
00515             sprintf(name,"HLTMuonL%iSeed_phi_IOHit",level-2);
00516             sprintf(title,"L%iSeed IOHit Muon #phi",level-2);
00517             hphi_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00518             hphi_IOHit[trig][level-1]->setAxisTitle("#phi", 1);
00519             sprintf(name,"HLTMuonL%iSeed_etaphi_IOHit",level-2);
00520             sprintf(title,"L%iSeed IOHit Muon #eta vs #phi",level-2);
00521             hetaphi_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00522             hetaphi_IOHit[trig][level-1]->setAxisTitle("#phi", 1);
00523             hetaphi_IOHit[trig][level-1]->setAxisTitle("#eta", 2);
00524             sprintf(name,"HLTMuonL%iSeed_ptphi_IOHit",level-2);
00525             sprintf(title,"L%iSeed IOHit Muon pt vs #phi",level-2);
00526             hptphi_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max, NBINS, -3.15, 3.15);
00527             hptphi_IOHit[trig][level-1]->setAxisTitle("pt", 1);
00528             hptphi_IOHit[trig][level-1]->setAxisTitle("#phi", 2);
00529             sprintf(name,"HLTMuonL%iSeed_pteta_IOHit",level-2);
00530             sprintf(title,"L%iSeed IOHit Muon pt vs #eta",level-2);
00531             hpteta_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., pt_max, NBINS, -2.5, 2.5);
00532             hpteta_IOHit[trig][level-1]->setAxisTitle("pt", 1);
00533             hpteta_IOHit[trig][level-1]->setAxisTitle("#eta", 2);
00534             sprintf(name,"HLTMuonL%iSeed_charge_IOHit",level-2);
00535             sprintf(title,"L%iSeed IOHit Muon Charge",level-2);
00536             hcharge_IOHit[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00537             hcharge_IOHit[trig][level-1]->setAxisTitle("Charge", 1);
00538 
00539           } 
00540         }
00541         else if( level == 6 ) {
00542           double max_energy = 1.0;
00543 
00544           sprintf(name,"HLTMuonL2_driso");
00545           sprintf(title,"dR Cone Size");
00546           hL2muonIsoDR[trig] = dbe_->book2D(name, title, 10, 0, 0.24, NBINS, 0, 5.0);
00547           hL2muonIsoDR[trig]->setAxisTitle(title, 1);
00548           hL2muonIsoDR[trig]->setAxisTitle("Calo Energy in Iso Cone (GeV)", 2);
00549 
00550           sprintf(name,"HLTMuonL3_driso");
00551           sprintf(title,"dR Cone Size");
00552           hL3muonIsoDR[trig] = dbe_->book2D(name, title, 10, 0, 0.24, NBINS, 0, 5.0);
00553           hL3muonIsoDR[trig]->setAxisTitle(title, 1);
00554           hL3muonIsoDR[trig]->setAxisTitle("Calo Energy in Iso Cone (GeV)", 2);
00555 
00556           sprintf(name,"HLTCaloTower_dRwithL2");
00557           sprintf(title,"#Delta R(L2muon, CaloTower)");
00558           htowerdRL2[trig] = dbe_->book1D(name, title, NBINS, 0, 0.5);
00559           htowerdRL2[trig]->setAxisTitle(title, 1);
00560           sprintf(name,"HLTCaloTower_dRwithL3");
00561           sprintf(title,"#Delta R(L3muon, CaloTower)");
00562           htowerdRL3[trig] = dbe_->book1D(name, title, NBINS, 0, 0.5);
00563           htowerdRL3[trig]->setAxisTitle(title, 1);
00564 
00565           sprintf(name,"HLTCaloTower_Et");
00566           sprintf(title,"HLT CaloTower Et");
00567           htowerEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00568           htowerEt[trig]->setAxisTitle(title, 1);
00569           sprintf(name,"HLTCaloTower_Eta");
00570           sprintf(title,"HLT CaloTower #eta");
00571           htowerEta[trig] = dbe_->book1D(name, title, NBINS, -2.5, 2.5);
00572           htowerEta[trig]->setAxisTitle(title, 1);
00573           sprintf(name,"HLTCaloTower_Phi");
00574           sprintf(title,"HLT CaloTower #phi");
00575           htowerPhi[trig] = dbe_->book1D(name, title, NBINS, -3.14, 3.14);
00576           htowerPhi[trig]->setAxisTitle(title, 1);
00577 
00578           sprintf(name,"HLTCaloTower_HadEnergy");
00579           sprintf(title,"HLT CaloTower hadEnergy");
00580           htowerHadEnergy[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00581           htowerHadEnergy[trig]->setAxisTitle(title, 1);
00582           sprintf(name,"HLTCaloTower_EmEnergy");
00583           sprintf(title,"HLT CaloTower emEnergy");
00584           htowerEmEnergy[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00585           htowerEmEnergy[trig]->setAxisTitle(title, 1);
00586           sprintf(name,"HLTCaloTower_OuterEnergy");
00587           sprintf(title,"HLT CaloTower outerEnergy");
00588           htowerOuterEnergy[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00589           htowerOuterEnergy[trig]->setAxisTitle(title, 1);
00590 
00591           sprintf(name,"HLTCaloTower_HadEt");
00592           sprintf(title,"HLT CaloTower hadEt");
00593           htowerHadEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00594           htowerHadEt[trig]->setAxisTitle(title, 1);
00595           sprintf(name,"HLTCaloTower_EmEt");
00596           sprintf(title,"HLT CaloTower emEt");
00597           htowerEmEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00598           htowerEmEt[trig]->setAxisTitle(title, 1);
00599           sprintf(name,"HLTCaloTower_OuterEt");
00600           sprintf(title,"HLT CaloTower outerEt");
00601           htowerOuterEt[trig] = dbe_->book1D(name, title, NBINS, 0, max_energy);
00602           htowerOuterEt[trig]->setAxisTitle(title, 1);
00603 
00604           sprintf(name,"HLTCaloTower_EtaHadEt");
00605           sprintf(title,"HLT CaloTower hadEt");
00606           htowerEtaHadEt[trig] = dbe_->book2D(name, title, NBINS, -2.5, 2.5, NBINS, 0, max_energy);
00607           htowerEtaHadEt[trig]->setAxisTitle("CaloTower #eta", 1);
00608           htowerEtaHadEt[trig]->setAxisTitle(title, 2);
00609           sprintf(name,"HLTCaloTower_EtaEmEt");
00610           sprintf(title,"HLT CaloTower emEt");
00611           htowerEtaEmEt[trig] = dbe_->book2D(name, title, NBINS, -2.5, 2.5, NBINS, 0, max_energy);
00612           htowerEtaEmEt[trig]->setAxisTitle("CaloTower #eta", 1);
00613           htowerEtaEmEt[trig]->setAxisTitle(title, 2);
00614           sprintf(name,"HLTCaloTower_EtaOuterEt");
00615           sprintf(title,"HLT CaloTower outerEt");
00616           htowerEtaOuterEt[trig] = dbe_->book2D(name, title, NBINS, -2.5, 2.5, NBINS, 0, max_energy);
00617           htowerEtaOuterEt[trig]->setAxisTitle("CaloTower #eta", 1);
00618           htowerEtaOuterEt[trig]->setAxisTitle(title, 2);
00619 
00620           sprintf(name,"HLTCaloTower_PhiHadEt");
00621           sprintf(title,"HLT CaloTower hadEt");
00622           htowerPhiHadEt[trig] = dbe_->book2D(name, title, NBINS, -3.15, 3.15, NBINS, 0, max_energy);
00623           htowerPhiHadEt[trig]->setAxisTitle("CaloTower #phi", 1);
00624           htowerPhiHadEt[trig]->setAxisTitle(title, 2);
00625           sprintf(name,"HLTCaloTower_PhiEmEt");
00626           sprintf(title,"HLT CaloTower emEt");
00627           htowerPhiEmEt[trig] = dbe_->book2D(name, title, NBINS, -3.15, 3.15, NBINS, 0, max_energy);
00628           htowerPhiEmEt[trig]->setAxisTitle("CaloTower #phi", 1);
00629           htowerPhiEmEt[trig]->setAxisTitle(title, 2);
00630           sprintf(name,"HLTCaloTower_PhiOuterEt");
00631           sprintf(title,"HLT CaloTower outerEt");
00632           htowerPhiOuterEt[trig] = dbe_->book2D(name, title, NBINS, -3.15, 3.15, NBINS, 0, max_energy);
00633           htowerPhiOuterEt[trig]->setAxisTitle("CaloTower #phi", 1);
00634           htowerPhiOuterEt[trig]->setAxisTitle(title, 2);
00635 
00636           sprintf(name,"HLTMuonL2_iso");
00637           sprintf(title,"L2 Muon Energy in Isolation cone");         
00638           hisoL2[trig] = dbe_->book1D(name,title, NBINS, 0., 5./1);
00639           hisoL2[trig]->setAxisTitle("Calo Energy in Iso Cone (GeV)", 1);
00640           sprintf(name,"HLTMuonL3_iso");
00641           sprintf(title,"L3 Muon SumPt in Isolation cone");               
00642           hisoL3[trig] = dbe_->book1D(name,title, NBINS, 0., 5./2);
00643           hisoL3[trig]->setAxisTitle("Sum Pt in Iso Cone (GeV)", 1);
00644         }
00645 
00646         if (level>1&&level<4){
00647 
00648           sprintf(name,"HLTMuonL%i_dr",level);
00649           sprintf(title,"L%i Muon radial impact vs BeamSpot",level);         
00650           hdr[trig][level-2] = dbe_->book1D(name,title, NBINS, -0.3, 0.3);
00651           hdr[trig][level-2]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
00652           sprintf(name,"HLTMuonL%i_d0",level);
00653           sprintf(title,"L%i Muon radial impact vs (0,0)",level);         
00654           hd0[trig][level-2] = dbe_->book1D(name,title, NBINS, -0.3, 0.3);
00655           hd0[trig][level-2]->setAxisTitle("R Impact (cm) vs 0,0", 1);
00656           sprintf(name,"HLTMuonL%i_dz0",level);
00657           sprintf(title,"L%i Muon Z impact vs (0)",level);         
00658           hdz0[trig][level-2] = dbe_->book1D(name,title, NBINS, -25., 25.);
00659           hdz0[trig][level-2]->setAxisTitle("Z impact (cm) vs 0", 1);
00660           sprintf(name,"HLTMuonL%i_dz",level);
00661           sprintf(title,"L%i Muon Z impact vs BeamSpot",level);         
00662           hdz[trig][level-2] = dbe_->book1D(name,title, NBINS, -25., 25.);
00663           hdz[trig][level-2]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
00664           sprintf(name,"HLTMuonL%i_err0",level);
00665           sprintf(title,"L%i Muon Error on Pt",level);         
00666           herr0[trig][level-2] = dbe_->book1D(name,title,NBINS, 0., 0.03);
00667           herr0[trig][level-2]->setAxisTitle("Error on Pt", 1);
00668           sprintf(name,"HLTMuonL%i_DiMuMass",level);
00669           sprintf(title,"L%i Opposite charge DiMuon invariant Mass",level);         
00670           hdimumass[trig][level-2]= dbe_->book1D(name,title, NBINS, 0., 150.);
00671           hdimumass[trig][level-2]->setAxisTitle("Di Muon Invariant Mass (GeV)");
00672 
00673           sprintf(name,"HLTMuonL%i_drphi",level);
00674           sprintf(title,"L%i #Deltar vs #phi",level);         
00675           hdrphi[trig][level-2] = dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
00676           hdrphi[trig][level-2]->setAxisTitle("#phi", 1);
00677           sprintf(title,"L%i Muon radial impact vs BeamSpot",level);         
00678           hdrphi[trig][level-2]->setAxisTitle(title, 2);
00679 
00680           sprintf(name,"HLTMuonL%i_d0phi",level);
00681           sprintf(title,"L%i #Delta0 vs #phi",level);         
00682           hd0phi[trig][level-2] = dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
00683           hd0phi[trig][level-2]->setAxisTitle("#phi", 1);
00684           sprintf(title,"L%i Muon radial impact vs (0,0)",level);         
00685           hd0phi[trig][level-2]->setAxisTitle(title, 2);
00686 
00687           sprintf(name,"HLTMuonL%i_dz0eta",level);
00688           sprintf(title,"L%i #Deltaz0 vs #eta",level);         
00689           hdz0eta[trig][level-2] = dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
00690           hdz0eta[trig][level-2]->setAxisTitle("#eta", 1);
00691           sprintf(title,"L%i Muon Z impact vs (0)",level);         
00692           hdz0eta[trig][level-2]->setAxisTitle(title, 2);
00693 
00694           sprintf(name,"HLTMuonL%i_dzeta",level);
00695           sprintf(title,"L%i #Deltaz vs #eta",level);         
00696           hdzeta[trig][level-2] = dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
00697           hdzeta[trig][level-2]->setAxisTitle("#eta", 1);
00698           sprintf(title,"L%i Muon Z impact vs BeamSpot",level);         
00699           hdzeta[trig][level-2]->setAxisTitle(title, 2);
00700 
00701         }
00702         if(level == 2 ) {
00703 
00704           sprintf(name,"HLTMuonL%itoL%i_ptpull",level,level+1);
00705           sprintf(title,"(L%iMuon1/Pt - L%iMuon1/Pt)/#sigma_{pt}^{L2}",level,level+1);         
00706           hptpull[trig] = dbe_->book1D(name,title, NBINS, -10.0, 10.0);
00707           sprintf(title,"(1/PtL%i - 1/PtL%i)/#sigma_{pt}^{L2}",level,level+1);         
00708           hptpull[trig]->setAxisTitle(title, 1);
00709           sprintf(name,"HLTMuonL%itoL%i_etapull",level,level+1);
00710           sprintf(title,"(L%iMuon#eta - L%iMuon#eta)/#sigma_{#eta}^{L2}",level,level+1);         
00711           hetapull[trig] =dbe_->book1D(name,title, NBINS, -10.0, 10.0);
00712           sprintf(title,"(L%i #eta - L%i #eta)/#sigma_{#eta}^{L2}",level,level+1);         
00713           hetapull[trig]->setAxisTitle(title, 1);
00714           sprintf(name,"HLTMuonL%itoL%i_phipull",level,level+1);
00715           sprintf(title,"(L%iMuon#phi - L%iMuon#phi)/#sigma_{#phi}^{L2}",level,level+1);         
00716           hphipull[trig] =dbe_->book1D(name,title, NBINS, -10.0, 10.0);
00717           sprintf(title,"(L%i #phi - L%i #phi)/#sigma_{#phi}^{L2}",level,level+1);         
00718           hphipull[trig]->setAxisTitle(title, 1);
00719 
00720           sprintf(name,"HLTMuonL%itoL%i_ptpullpt",level,level+1);
00721           sprintf(title,"L%i Muon #Delta Pt/#sigma_{pt}^{L2} vs Pt ",level);         
00722           hptpullpt[trig] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
00723           sprintf(title,"(1/PtL%i - 1/PtL%i)/#sigma_{pt}^{L2}",level,level+1);         
00724           hptpullpt[trig]->setAxisTitle(title, 2);
00725           hptpullpt[trig]->setAxisTitle("Pt", 1);
00726           sprintf(name,"HLTMuonL%itoL%i_etapulleta",level,level+1);
00727           sprintf(title,"L%i Muon #Delta#eta/#sigma_{#eta}^{L2} vs #eta ",level);         
00728           hetapulleta[trig] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
00729           sprintf(title,"(L%i #eta - L%i #eta)/#sigma_{#eta}^{L2}",level,level+1);         
00730           hetapulleta[trig]->setAxisTitle(title, 2);
00731           hetapulleta[trig]->setAxisTitle("#eta", 1);
00732           sprintf(name,"HLTMuonL%itoL%i_phipullphi",level,level+1);
00733           sprintf(title,"L%i Muon #Delta#phi/#sigma_{#phi}^{L2} vs #phi ",level);         
00734           hphipullphi[trig] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
00735           sprintf(title,"(L%i #phi - L%i #phi)/#sigma_{#phi}^{L2}",level,level+1);         
00736           hphipullphi[trig]->setAxisTitle(title, 2);
00737           hphipullphi[trig]->setAxisTitle("#phi", 1);
00738 
00739         }
00740         if( level == 3 ){
00741           sprintf(name,"HLTMuonL3_NMu_comp");
00742           sprintf(title,"Comparison of each HLT L3 Muons");
00743           hNMu_comp[trig][level-1] = dbe_->book1D(name,title,4,0,4);
00744           hNMu_comp[trig][level-1]->setAxisTitle("Number of muons",1);
00745           hNMu_comp[trig][level-1]->setBinLabel(1, "Cascade", 1);
00746           hNMu_comp[trig][level-1]->setBinLabel(2, "OIState", 1);
00747           hNMu_comp[trig][level-1]->setBinLabel(3, "OIHit", 1);
00748           hNMu_comp[trig][level-1]->setBinLabel(4, "IOHit", 1);
00749           sprintf(name,"HLTMuonL3_trk_NMu_comp");
00750           sprintf(title,"Comparison of each HLT L3 Muons");
00751           hNMu_trk_comp[trig][level-1] = dbe_->book1D(name,title,4,0,4);
00752           hNMu_trk_comp[trig][level-1]->setAxisTitle("Number of muons",1);
00753           hNMu_trk_comp[trig][level-1]->setBinLabel(1, "Cascade", 1);
00754           hNMu_trk_comp[trig][level-1]->setBinLabel(2, "OIState", 1);
00755           hNMu_trk_comp[trig][level-1]->setBinLabel(3, "OIHit", 1);
00756           hNMu_trk_comp[trig][level-1]->setBinLabel(4, "IOHit", 1);
00757 
00758           sprintf(name,"HLTMuonL%i_trk_NMu",level);
00759           sprintf(title," L%i tracker number of muons",level);
00760           hNMu_trk[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
00761           hNMu_trk[trig][level-1]->setAxisTitle("Number of muons", 1);
00762           sprintf(name,"HLTMuonL%i_trk_pt",level);
00763           sprintf(title,"L%i tracker Muon Pt",level);
00764           hpt_trk[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
00765           hpt_trk[trig][level-1]->setAxisTitle("Pt", 1);
00766           sprintf(name,"HLTMuonL%i_trk_eta",level);
00767           sprintf(title,"L%i tracker Muon #eta",level);
00768           heta_trk[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00769           heta_trk[trig][level-1]->setAxisTitle("#eta", 1);
00770           sprintf(name,"HLTMuonL%i_trk_phi",level);
00771           sprintf(title,"L%i tracker Muon #phi",level);
00772           hphi_trk[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00773           hphi_trk[trig][level-1]->setAxisTitle("#phi", 1);
00774           sprintf(name,"HLTMuonL%i_trk_etaphi",level);
00775           sprintf(title,"L%i tracker Muon #eta vs #phi",level);
00776           hetaphi_trk[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00777           hetaphi_trk[trig][level-1]->setAxisTitle("#phi", 1);
00778           hetaphi_trk[trig][level-1]->setAxisTitle("#eta", 2);
00779           sprintf(name,"HLTMuonL%i_trk_ptphi",level);
00780           sprintf(title,"L%i tracker Muon pt vs #phi",level);
00781           hptphi_trk[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
00782           hptphi_trk[trig][level-1]->setAxisTitle("pt", 1);
00783           hptphi_trk[trig][level-1]->setAxisTitle("#phi", 2);
00784           sprintf(name,"HLTMuonL%i_trk_pteta",level);
00785           sprintf(title,"L%i tracker Muon pt vs #eta",level);
00786           hpteta_trk[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
00787           hpteta_trk[trig][level-1]->setAxisTitle("pt", 1);
00788           hpteta_trk[trig][level-1]->setAxisTitle("#eta", 2);
00789           sprintf(name,"HLTMuonL%i_trk_charge",level);
00790           sprintf(title,"L%i tracker Muon Charge",level);
00791           hcharge_trk[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00792           hcharge_trk[trig][level-1]->setAxisTitle("Charge", 1);
00793           sprintf(name,"HLTMuonL%i_trk_d0",level);
00794           sprintf(title,"L%i tracker Muon from  radial impact vs (0,0)",level);
00795           hd0_trk[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00796           hd0_trk[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
00797           sprintf(name,"HLTMuonL%i_trk_dz",level);
00798           sprintf(title,"L%i tracker Muon from Z impact vs BeamSpot",level);
00799           hdz_trk[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
00800           hdz_trk[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
00801           sprintf(name,"HLTMuonL%i_trk_dr",level);
00802           sprintf(title,"L%i tracker Muon radial impact vs BeamSpot",level);
00803           hdr_trk[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00804           hdr_trk[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
00805 
00806           hptres_L3L3trk[trig][level-1] = dbe_->book1D("HLTMuonL3toL3trk_ptres","L3Muon 1/Pt - L3trkMuon 1/Pt;L3 1/P_{T} - L3 trk 1/P_{T}",50+1,-0.02,0.02);
00807 
00808           hetares_L3L3trk[trig][level-1] = dbe_->book1D("HLTMuonL3toL3trk_etares","L3Muon #eta - L3trkMuon #eta;L3 #eta - L3 trk #eta",50,-0.02,0.02);
00809           hphires_L3L3trk[trig][level-1] = dbe_->book1D("HLTMuonL3toL3trk_phires","L3Muon #phi - L3trkMuon #phi;L3 #phi - L3 trk #phi",50,-0.02,0.02);
00810           hptrelres_L3L3trk[trig][level-1] = dbe_->book1D("HLTMuonL3toL3trk_ptrelres","(L3Muon 1/Pt - L3trkMuon 1/Pt)/(L3Muon 1/Pt);(L3 1/P_{T} - L3 trk 1/P_{T})/(L3 1/P_{T})",50,-0.05,0.05);
00811           hetarelres_L3L3trk[trig][level-1] = dbe_->book1D("HLTMuonL3toL3trk_etarelres","(L3Muon #eta - L3trkMuon #eta)/L3Muon #eta;(L3 #eta - L3 trk #eta)/L3 #eta",50,-0.02,0.02);
00812           hphirelres_L3L3trk[trig][level-1] = dbe_->book1D("HLTMuonL3toL3trk_phirelres","(L3Muon #phi - L3trkMuon #phi)/L3Muon #phi;(L3 #phi - L3 trk #phi)/L3 #phi",50,-0.02,0.02);
00813 
00814           dbe_->setCurrentFolder(monitorName_+dirname+"Level3/OIState");
00815 
00816           sprintf(name,"HLTMuonL%i_NMu_OIState",level);
00817           sprintf(title,"OIState L%i number of muons",level);
00818           hNMu_OIState[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
00819           hNMu_OIState[trig][level-1]->setAxisTitle("Number of muons", 1);
00820           sprintf(name,"HLTMuonL%i_pt_OIState",level);
00821           sprintf(title,"L%i Pt_OIState",level);
00822           hpt_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
00823           hpt_OIState[trig][level-1]->setAxisTitle("Pt", 1);
00824           sprintf(name,"HLTMuonL%i_eta_OIState",level);
00825           sprintf(title,"L%i Muon #eta_OIState",level);
00826           heta_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00827           heta_OIState[trig][level-1]->setAxisTitle("#eta", 1);
00828           sprintf(name,"HLTMuonL%i_phi_OIState",level);
00829           sprintf(title,"L%i Muon #phi_OIState",level);
00830           hphi_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00831           hphi_OIState[trig][level-1]->setAxisTitle("#phi", 1);
00832           sprintf(name,"HLTMuonL%i_etaphi_OIState",level);
00833           sprintf(title,"L%i Muon #eta vs #phi_OIState",level);
00834           hetaphi_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00835           hetaphi_OIState[trig][level-1]->setAxisTitle("#phi", 1);
00836           hetaphi_OIState[trig][level-1]->setAxisTitle("#eta", 2);
00837           sprintf(name,"HLTMuonL%i_ptphi_OIState",level);
00838           sprintf(title,"L%i Muon pt vs #phi_OIState",level);
00839           hptphi_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
00840           hptphi_OIState[trig][level-1]->setAxisTitle("pt", 1);
00841           hptphi_OIState[trig][level-1]->setAxisTitle("#phi", 2);
00842           sprintf(name,"HLTMuonL%i_pteta_OIState",level);
00843           sprintf(title,"L%i Muon pt vs #eta_OIState",level);
00844           hpteta_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
00845           hpteta_OIState[trig][level-1]->setAxisTitle("pt", 1);
00846           hpteta_OIState[trig][level-1]->setAxisTitle("#eta", 2);
00847           sprintf(name,"HLTMuonL%i_charge_OIState",level);
00848           sprintf(title,"L%i Muon Charge_OIState",level);
00849           hcharge_OIState[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00850           hcharge_OIState[trig][level-1]->setAxisTitle("Charge", 1);
00851           sprintf(name,"HLTMuonL%i_d0_OIState",level);
00852           sprintf(title,"L%i Muon from OIState radial impact vs (0,0)",level);
00853           hd0_OIState[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00854           hd0_OIState[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
00855           sprintf(name,"HLTMuonL%i_dz_OIState",level);
00856           sprintf(title,"L%i Muon from OIStateZ impact vs BeamSpot",level);
00857           hdz_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
00858           hdz_OIState[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
00859           sprintf(name,"HLTMuonL%i_dr_OIState",level);
00860           sprintf(title,"L%i Muon from OIState radial impact vs BeamSpot",level);
00861           hdr_OIState[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00862           hdr_OIState[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
00863 
00864           sprintf(name,"HLTMuonL%i_trk_OIState_NMu",level);
00865           sprintf(title," L%i OIState tracker number of muons",level);
00866           hNMu_trk_OIState[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
00867           hNMu_trk_OIState[trig][level-1]->setAxisTitle("Number of muons", 1);
00868           sprintf(name,"HLTMuonL%i_trk_OIState_pt",level);
00869           sprintf(title,"L%i OIState tracker Muon Pt",level);
00870           hpt_trk_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
00871           hpt_trk_OIState[trig][level-1]->setAxisTitle("Pt", 1);
00872           sprintf(name,"HLTMuonL%i_trk_OIState_eta",level);
00873           sprintf(title,"L%i OIState tracker Muon #eta",level);
00874           heta_trk_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00875           heta_trk_OIState[trig][level-1]->setAxisTitle("#eta", 1);
00876           sprintf(name,"HLTMuonL%i_trk_OIState_phi",level);
00877           sprintf(title,"L%i OIState tracker Muon #phi",level);
00878           hphi_trk_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00879           hphi_trk_OIState[trig][level-1]->setAxisTitle("#phi", 1);
00880           sprintf(name,"HLTMuonL%i_trk_OIState_etaphi",level);
00881           sprintf(title,"L%i OIState tracker Muon #eta vs #phi",level);
00882           hetaphi_trk_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00883           hetaphi_trk_OIState[trig][level-1]->setAxisTitle("#phi", 1);
00884           hetaphi_trk_OIState[trig][level-1]->setAxisTitle("#eta", 2);
00885           sprintf(name,"HLTMuonL%i_trk_OIState_ptphi",level);
00886           sprintf(title,"L%i OIState tracker Muon pt vs #phi",level);
00887           hptphi_trk_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
00888           hptphi_trk_OIState[trig][level-1]->setAxisTitle("pt", 1);
00889           hptphi_trk_OIState[trig][level-1]->setAxisTitle("#phi", 2);
00890           sprintf(name,"HLTMuonL%i_trk_OIState_pteta",level);
00891           sprintf(title,"L%i OIState tracker Muon pt vs #eta",level);
00892           hpteta_trk_OIState[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
00893           hpteta_trk_OIState[trig][level-1]->setAxisTitle("pt", 1);
00894           hpteta_trk_OIState[trig][level-1]->setAxisTitle("#eta", 2);
00895           sprintf(name,"HLTMuonL%i_trk_OIState_charge",level);
00896           sprintf(title,"L%i OIState tracker Muon Charge",level);
00897           hcharge_trk_OIState[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00898           hcharge_trk_OIState[trig][level-1]->setAxisTitle("Charge", 1);
00899           sprintf(name,"HLTMuonL%i_trk_OIState_d0",level);
00900           sprintf(title,"L%i OIState tracker Muon from  radial impact vs (0,0)",level);
00901           hd0_trk_OIState[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00902           hd0_trk_OIState[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
00903           sprintf(name,"HLTMuonL%i_trk_OIState_dz",level);
00904           sprintf(title,"L%i OIState tracker Muon from Z impact vs BeamSpot",level);
00905           hdz_trk_OIState[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
00906           hdz_trk_OIState[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
00907           sprintf(name,"HLTMuonL%i_trk_OIState_dr",level);
00908           sprintf(title,"L%i OIState tracker Muon radial impact vs BeamSpot",level);
00909           hdr_trk_OIState[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00910           hdr_trk_OIState[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
00911 
00912           dbe_->setCurrentFolder(monitorName_+dirname+"Level3/OIHit");
00913 
00914           sprintf(name,"HLTMuonL%i_NMu_OIHit",level);
00915           sprintf(title,"OIHit L%i number of muons",level);
00916           hNMu_OIHit[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
00917           hNMu_OIHit[trig][level-1]->setAxisTitle("Number of muons", 1);
00918 
00919           sprintf(name,"HLTMuonL%i_pt_OIHit",level);
00920           sprintf(title,"L%i Pt_OIHit",level);
00921           hpt_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
00922           hpt_OIHit[trig][level-1]->setAxisTitle("Pt", 1);
00923           sprintf(name,"HLTMuonL%i_eta_OIHit",level);
00924           sprintf(title,"L%i Muon #eta_OIHit",level);
00925           heta_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00926           heta_OIHit[trig][level-1]->setAxisTitle("#eta", 1);
00927           sprintf(name,"HLTMuonL%i_phi_OIHit",level);
00928           sprintf(title,"L%i Muon #phi_OIHit",level);
00929           hphi_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00930           hphi_OIHit[trig][level-1]->setAxisTitle("#phi", 1);
00931           sprintf(name,"HLTMuonL%i_etaphi_OIHit",level);
00932           sprintf(title,"L%i Muon #eta vs #phi_OIHit",level);
00933           hetaphi_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00934           hetaphi_OIHit[trig][level-1]->setAxisTitle("#phi", 1);
00935           hetaphi_OIHit[trig][level-1]->setAxisTitle("#eta", 2);
00936           sprintf(name,"HLTMuonL%i_ptphi_OIHit",level);
00937           sprintf(title,"L%i Muon pt vs #phi_OIHit",level);
00938           hptphi_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
00939           hptphi_OIHit[trig][level-1]->setAxisTitle("pt", 1);
00940           hptphi_OIHit[trig][level-1]->setAxisTitle("#phi", 2);
00941           sprintf(name,"HLTMuonL%i_pteta_OIHit",level);
00942           sprintf(title,"L%i Muon pt vs #eta_OIHit",level);
00943           hpteta_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
00944           hpteta_OIHit[trig][level-1]->setAxisTitle("pt", 1);
00945           hpteta_OIHit[trig][level-1]->setAxisTitle("#eta", 2);
00946           sprintf(name,"HLTMuonL%i_charge_OIHit",level);
00947           sprintf(title,"L%i Muon Charge_OIHit",level);
00948           hcharge_OIHit[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00949           hcharge_OIHit[trig][level-1]->setAxisTitle("Charge", 1);
00950  
00951           sprintf(name,"HLTMuonL%i_d0_OIHit",level);
00952           sprintf(title,"L%i Muon from OIHit radial impact vs (0,0)",level);
00953           hd0_OIHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00954           hd0_OIHit[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
00955           sprintf(name,"HLTMuonL%i_dz_OIHit",level);
00956           sprintf(title,"L%i Muon from OIHit Z impact vs BeamSpot",level);
00957           hdz_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
00958           hdz_OIHit[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
00959           sprintf(name,"HLTMuonL%i_dr_OIHit",level);
00960           sprintf(title,"L%i Muon from OIHit radial impact vs BeamSpot",level);
00961           hdr_OIHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
00962           hdr_OIHit[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
00963 
00964           sprintf(name,"HLTMuonL%i_trk_OIHit_NMu",level);
00965           sprintf(title," L%i OIHit tracker number of muons",level);
00966           hNMu_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
00967           hNMu_trk_OIHit[trig][level-1]->setAxisTitle("Number of muons", 1);
00968           sprintf(name,"HLTMuonL%i_trk_OIHit_pt",level);
00969           sprintf(title,"L%i OIHit tracker Muon Pt",level);
00970           hpt_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
00971           hpt_trk_OIHit[trig][level-1]->setAxisTitle("Pt", 1);
00972           sprintf(name,"HLTMuonL%i_trk_OIHit_eta",level);
00973           sprintf(title,"L%i OIHit tracker Muon #eta",level);
00974           heta_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
00975           heta_trk_OIHit[trig][level-1]->setAxisTitle("#eta", 1);
00976           sprintf(name,"HLTMuonL%i_trk_OIHit_phi",level);
00977           sprintf(title,"L%i OIHit tracker Muon #phi",level);
00978           hphi_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
00979           hphi_trk_OIHit[trig][level-1]->setAxisTitle("#phi", 1);
00980           sprintf(name,"HLTMuonL%i_trk_OIHit_etaphi",level);
00981           sprintf(title,"L%i OIHit tracker Muon #eta vs #phi",level);
00982           hetaphi_trk_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
00983           hetaphi_trk_OIHit[trig][level-1]->setAxisTitle("#phi", 1);
00984           hetaphi_trk_OIHit[trig][level-1]->setAxisTitle("#eta", 2);
00985           sprintf(name,"HLTMuonL%i_trk_OIHit_ptphi",level);
00986           sprintf(title,"L%i OIHit tracker Muon pt vs #phi",level);
00987           hptphi_trk_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
00988           hptphi_trk_OIHit[trig][level-1]->setAxisTitle("pt", 1);
00989           hptphi_trk_OIHit[trig][level-1]->setAxisTitle("#phi", 2);
00990           sprintf(name,"HLTMuonL%i_trk_OIHit_pteta",level);
00991           sprintf(title,"L%i OIHit tracker Muon pt vs #eta",level);
00992           hpteta_trk_OIHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
00993           hpteta_trk_OIHit[trig][level-1]->setAxisTitle("pt", 1);
00994           hpteta_trk_OIHit[trig][level-1]->setAxisTitle("#eta", 2);
00995           sprintf(name,"HLTMuonL%i_trk_OIHit_charge",level);
00996           sprintf(title,"L%i OIHit tracker Muon Charge",level);
00997           hcharge_trk_OIHit[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
00998           hcharge_trk_OIHit[trig][level-1]->setAxisTitle("Charge", 1);
00999           sprintf(name,"HLTMuonL%i_trk_OIHit_d0",level);
01000           sprintf(title,"L%i OIHit tracker Muon from  radial impact vs (0,0)",level);
01001           hd0_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
01002           hd0_trk_OIHit[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
01003           sprintf(name,"HLTMuonL%i_trk_OIHit_dz",level);
01004           sprintf(title,"L%i OIHit tracker Muon from Z impact vs BeamSpot",level);
01005           hdz_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
01006           hdz_trk_OIHit[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
01007           sprintf(name,"HLTMuonL%i_trk_OIHit_dr",level);
01008           sprintf(title,"L%i OIHit tracker Muon radial impact vs BeamSpot",level);
01009           hdr_trk_OIHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
01010           hdr_trk_OIHit[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
01011 
01012           dbe_->setCurrentFolder(monitorName_+dirname+"Level3/IOHit");
01013 
01014           sprintf(name,"HLTMuonL%i_NMu_IOHit",level);
01015           sprintf(title,"IOHit L%i number of muons",level);
01016           hNMu_IOHit[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
01017           hNMu_IOHit[trig][level-1]->setAxisTitle("Number of muons", 1);
01018 
01019           sprintf(name,"HLTMuonL%i_pt_IOHit",level);
01020           sprintf(title,"L%i Pt_IOHit",level);
01021           hpt_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
01022           hpt_IOHit[trig][level-1]->setAxisTitle("Pt", 1);
01023           sprintf(name,"HLTMuonL%i_eta_IOHit",level);
01024           sprintf(title,"L%i Muon #eta_IOHit",level);
01025           heta_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
01026           heta_IOHit[trig][level-1]->setAxisTitle("#eta", 1);
01027           sprintf(name,"HLTMuonL%i_phi_IOHit",level);
01028           sprintf(title,"L%i Muon #phi_IOHit",level);
01029           hphi_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
01030           hphi_IOHit[trig][level-1]->setAxisTitle("#phi", 1);
01031           sprintf(name,"HLTMuonL%i_etaphi_IOHit",level);
01032           sprintf(title,"L%i Muon #eta vs #phi_IOHit",level);
01033           hetaphi_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
01034           hetaphi_IOHit[trig][level-1]->setAxisTitle("#phi", 1);
01035           hetaphi_IOHit[trig][level-1]->setAxisTitle("#eta", 2);
01036           sprintf(name,"HLTMuonL%i_ptphi_IOHit",level);
01037           sprintf(title,"L%i Muon pt vs #phi_IOHit",level);
01038           hptphi_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
01039           hptphi_IOHit[trig][level-1]->setAxisTitle("pt", 1);
01040           hptphi_IOHit[trig][level-1]->setAxisTitle("#phi", 2);
01041           sprintf(name,"HLTMuonL%i_pteta_IOHit",level);
01042           sprintf(title,"L%i Muon pt vs #eta_IOHit",level);
01043           hpteta_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
01044           hpteta_IOHit[trig][level-1]->setAxisTitle("pt", 1);
01045           hpteta_IOHit[trig][level-1]->setAxisTitle("#eta", 2);
01046           sprintf(name,"HLTMuonL%i_charge_IOHit",level);
01047           sprintf(title,"L%i Muon Charge_IOHit",level);
01048           hcharge_IOHit[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
01049           hcharge_IOHit[trig][level-1]->setAxisTitle("Charge", 1);
01050 
01051           sprintf(name,"HLTMuonL%i_d0_IOHit",level);
01052           sprintf(title,"L%i Muon from IOHit radial impact vs (0,0)",level);
01053           hd0_IOHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
01054           hd0_IOHit[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
01055           sprintf(name,"HLTMuonL%i_dz_IOHit",level);
01056           sprintf(title,"L%i Muon from IOHit Z impact vs BeamSpot",level);
01057           hdz_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
01058           hdz_IOHit[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
01059           sprintf(name,"HLTMuonL%i_dr_IOHit",level);
01060           sprintf(title,"L%i Muon from IOHit radial impact vs BeamSpot",level);
01061           hdr_IOHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
01062           hdr_IOHit[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
01063 
01064           sprintf(name,"HLTMuonL%i_trk_IOHit_NMu",level);
01065           sprintf(title," L%i IOHit tracker number of muons",level);
01066           hNMu_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, 10, -0.5, 10.5);
01067           hNMu_trk_IOHit[trig][level-1]->setAxisTitle("Number of muons", 1);
01068           sprintf(name,"HLTMuonL%i_trk_IOHit_pt",level);
01069           sprintf(title,"L%i IOHit tracker Muon Pt",level);
01070           hpt_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, 0., 200);
01071           hpt_trk_IOHit[trig][level-1]->setAxisTitle("Pt", 1);
01072           sprintf(name,"HLTMuonL%i_trk_IOHit_eta",level);
01073           sprintf(title,"L%i IOHit tracker Muon #eta",level);
01074           heta_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -2.5, 2.5);
01075           heta_trk_IOHit[trig][level-1]->setAxisTitle("#eta", 1);
01076           sprintf(name,"HLTMuonL%i_trk_IOHit_phi",level);
01077           sprintf(title,"L%i IOHit tracker Muon #phi",level);
01078           hphi_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -3.15, 3.15);
01079           hphi_trk_IOHit[trig][level-1]->setAxisTitle("#phi", 1);
01080           sprintf(name,"HLTMuonL%i_trk_IOHit_etaphi",level);
01081           sprintf(title,"L%i IOHit tracker Muon #eta vs #phi",level);
01082           hetaphi_trk_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, -3.15, 3.15, NBINS, -2.5, 2.5);
01083           hetaphi_trk_IOHit[trig][level-1]->setAxisTitle("#phi", 1);
01084           hetaphi_trk_IOHit[trig][level-1]->setAxisTitle("#eta", 2);
01085           sprintf(name,"HLTMuonL%i_trk_IOHit_ptphi",level);
01086           sprintf(title,"L%i IOHit tracker Muon pt vs #phi",level);
01087           hptphi_trk_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -3.15, 3.15);
01088           hptphi_trk_IOHit[trig][level-1]->setAxisTitle("pt", 1);
01089           hptphi_trk_IOHit[trig][level-1]->setAxisTitle("#phi", 2);
01090           sprintf(name,"HLTMuonL%i_trk_IOHit_pteta",level);
01091           sprintf(title,"L%i IOHit tracker Muon pt vs #eta",level);
01092           hpteta_trk_IOHit[trig][level-1] = dbe_->book2D(name,title, NBINS, 0., 200, NBINS, -2.5, 2.5);
01093           hpteta_trk_IOHit[trig][level-1]->setAxisTitle("pt", 1);
01094           hpteta_trk_IOHit[trig][level-1]->setAxisTitle("#eta", 2);
01095           sprintf(name,"HLTMuonL%i_trk_IOHit_charge",level);
01096           sprintf(title,"L%i IOHit tracker Muon Charge",level);
01097           hcharge_trk_IOHit[trig][level-1]  = dbe_->book1D(name,title, 3, -1.5, 1.5);
01098           hcharge_trk_IOHit[trig][level-1]->setAxisTitle("Charge", 1);
01099           sprintf(name,"HLTMuonL%i_trk_IOHit_d0",level);
01100           sprintf(title,"L%i IOHit tracker Muon from  radial impact vs (0,0)",level);
01101           hd0_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
01102           hd0_trk_IOHit[trig][level-1]->setAxisTitle("R Impact (cm) vs 0,0", 1);
01103           sprintf(name,"HLTMuonL%i_trk_IOHit_dz",level);
01104           sprintf(title,"L%i IOHit tracker Muon from Z impact vs BeamSpot",level);
01105           hdz_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, NBINS, -25., 25.);
01106           hdz_trk_IOHit[trig][level-1]->setAxisTitle("Z impact (cm) vs BeamSpot", 1);
01107           sprintf(name,"HLTMuonL%i_trk_IOHit_dr",level);
01108           sprintf(title,"L%i IOHit tracker Muon radial impact vs BeamSpot",level);
01109           hdr_trk_IOHit[trig][level-1] = dbe_->book1D(name,title, 50, -0.3, 0.3 );
01110           hdr_trk_IOHit[trig][level-1]->setAxisTitle("R Impact (cm) vs BeamSpot", 1);
01111 
01112         }
01113         if (level < 3 ) {
01114 
01115           // res
01116           sprintf(name,"HLTMuonL%itoL%i_ptres",level,level+1);
01117           sprintf(title,"L%iMuon1/Pt - L%iMuon1/Pt",level,level+1);         
01118           hptres[trig][level-1] = dbe_->book1D(name,title, NBINS, -0.1, 0.1);
01119           sprintf(title,"1/PtL%i - 1/PtL%i",level,level+1);         
01120           hptres[trig][level-1]->setAxisTitle(title, 1);
01121           sprintf(name,"HLTMuonL%itoL%i_etares",level,level+1);
01122           sprintf(title,"L%iMuon#eta - L%iMuon#eta",level,level+1);         
01123           hetares[trig][level-1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
01124           sprintf(title,"L%i #eta - L%i #eta",level,level+1);         
01125           hetares[trig][level-1]->setAxisTitle(title, 1);
01126           sprintf(name,"HLTMuonL%itoL%i_phires",level,level+1);
01127           sprintf(title,"L%iMuon#phi - L%iMuon#phi",level,level+1);         
01128           hphires[trig][level-1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
01129           sprintf(title,"L%i #phi - L%i #phi",level,level+1);         
01130           hphires[trig][level-1]->setAxisTitle(title, 1);
01131 
01132           sprintf(name,"HLTMuonL%itoL%i_ptrespt",level,level+1);
01133           sprintf(title,"L%i Muon #Delta Pt vs Pt ",level);         
01134           hptrespt[trig][level-1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
01135           sprintf(title,"1/PtL%i - 1/PtL%i",level,level+1);         
01136           hptrespt[trig][level-1]->setAxisTitle(title, 2);
01137           hptrespt[trig][level-1]->setAxisTitle("Pt", 1);
01138           sprintf(name,"HLTMuonL%itoL%i_phiresphi",level,level+1);
01139           sprintf(title,"L%i Muon #Delta#phi vs #phi ",level);         
01140           hphiresphi[trig][level-1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
01141           sprintf(title,"L%i #phi - L%i #phi",level,level+1);         
01142           hphiresphi[trig][level-1]->setAxisTitle(title, 2);
01143           hphiresphi[trig][level-1]->setAxisTitle("#phi", 1);
01144           sprintf(name,"HLTMuonL%itoL%i_etareseta",level,level+1);
01145           sprintf(title,"L%i Muon #Delta#eta vs #eta ",level);         
01146           hetareseta[trig][level-1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
01147           sprintf(title,"L%i #eta - L%i #eta",level,level+1);         
01148           hetareseta[trig][level-1]->setAxisTitle(title, 2);
01149           hetareseta[trig][level-1]->setAxisTitle("#eta", 1);
01150 
01151           // relres
01152           sprintf(name,"HLTMuonL%itoL%i_ptrelres",level,level+1);
01153           sprintf(title,"(L%iMuon1/Pt - L%iMuon1/Pt)/(L%iMuon1/Pt)",level,level+1,level+1);         
01154           hptrelres[trig][level-1] = dbe_->book1D(name,title, NBINS, -1.0, 1.0);
01155           sprintf(title,"(1/PtL%i - 1/PtL%i)/(1/PtL%i)",level,level+1,level+1);         
01156           hptrelres[trig][level-1]->setAxisTitle(title, 1);
01157           sprintf(name,"HLTMuonL%itoL%i_etarelres",level,level+1);
01158           sprintf(title,"(L%iMuon#eta - L%iMuon#eta)/L%iMuon#eta",level,level+1,level+1);         
01159           hetarelres[trig][level-1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
01160           sprintf(title,"(L%i #eta - L%i #eta)/L%i #eta",level,level+1,level+1);         
01161           hetarelres[trig][level-1]->setAxisTitle(title, 1);
01162           sprintf(name,"HLTMuonL%itoL%i_phirelres",level,level+1);
01163           sprintf(title,"(L%iMuon#phi - L%iMuon#phi)/L%iMuon#phi",level,level+1,level+1);         
01164           hphirelres[trig][level-1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
01165           sprintf(title,"(L%i #phi - L%i #phi)/L%i #phi",level,level+1,level+1);         
01166           hphirelres[trig][level-1]->setAxisTitle(title, 1);
01167 
01168           sprintf(name,"HLTMuonL%itoL%i_ptrelrespt",level,level+1);
01169           sprintf(title,"L%i Muon #DeltaPt/Pt vs Pt ",level);         
01170           hptrelrespt[trig][level-1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
01171           sprintf(title,"(1/PtL%i - 1/PtL%i)/(1/PtL%i)",level,level+1,level+1);         
01172           hptrelrespt[trig][level-1]->setAxisTitle(title, 2);
01173           hptrelrespt[trig][level-1]->setAxisTitle("Pt", 1);
01174           sprintf(name,"HLTMuonL%itoL%i_phirelresphi",level,level+1);
01175           sprintf(title,"L%i Muon #Delta#phi/#phi vs #phi ",level);         
01176           hphirelresphi[trig][level-1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
01177           sprintf(title,"(L%i #phi - L%i #phi)/L%i #phi",level,level+1,level+1);         
01178           hphirelresphi[trig][level-1]->setAxisTitle(title, 2);
01179           hphirelresphi[trig][level-1]->setAxisTitle("#phi", 1);
01180           sprintf(name,"HLTMuonL%itoL%i_etarelreseta",level,level+1);
01181           sprintf(title,"L%i Muon #Delta#eta/#eta vs #eta ",level);         
01182           hetarelreseta[trig][level-1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
01183           sprintf(title,"(L%i #eta - L%i #eta)/L%i #eta",level,level+1,level+1);         
01184           hetarelreseta[trig][level-1]->setAxisTitle(title, 2);
01185           hetarelreseta[trig][level-1]->setAxisTitle("#eta", 1);
01186           // charge conversion
01187           sprintf(name,"HLTMuonL%itoL%i_chargeconvers",level,level+1);
01188           sprintf(title,"L%i Muon charge #rightarrow L%i Muon charge",level,level+1);         
01189           hchargeconv[trig][level-1] =dbe_->book1D(name,title, 4, 0, 4);
01190           hchargeconv[trig][level-1]->setAxisTitle(title, 1);
01191           hchargeconv[trig][level-1]->setBinLabel(1, "- #rightarrow -", 1);
01192           hchargeconv[trig][level-1]->setBinLabel(2, "- #rightarrow +", 1);
01193           hchargeconv[trig][level-1]->setBinLabel(3, "+ #rightarrow -", 1);
01194           hchargeconv[trig][level-1]->setBinLabel(4, "+ #rightarrow +", 1);
01195           // reconstruction fraction with dependence
01196           sprintf(name,"HLTMuonL%itoL%i_fracpt",level,level+1);
01197           sprintf(title,"#ofL%iMuon/#ofL%iMuon",level+1,level);         
01198           hptfrac[trig][level-1] = dbe_->book1D(name,title, 40, 0, pt_max);
01199           hptfrac[trig][level-1]->setAxisTitle("Pt", 1);
01200           sprintf(name,"HLTMuonL%itoL%i_fraceta",level,level+1);
01201           sprintf(title,"#ofL%iMuon/#ofL%iMuon",level+1,level);         
01202           hetafrac[trig][level-1] = dbe_->book1D(name,title, 40, -2.5, 2.5);
01203           hetafrac[trig][level-1]->setAxisTitle("#eta", 1);
01204           sprintf(name,"HLTMuonL%itoL%i_fracphi",level,level+1);
01205           sprintf(title,"#ofL%iMuon/#ofL%iMuon",level+1,level);         
01206           hphifrac[trig][level-1] = dbe_->book1D(name,title, 40, -3.15, 3.15);
01207           hphifrac[trig][level-1]->setAxisTitle("#phi", 1);
01208           if (level  == 1 ){
01209             // res
01210             sprintf(name,"HLTMuonL%itoL3_ptres",level);
01211             sprintf(title,"L%iMuon1/Pt - L%iMuon1/Pt",level,level+2);         
01212             hptres[trig][level+1] = dbe_->book1D(name,title, NBINS, -0.1, 0.1);
01213             sprintf(title,"1/PtL%i - 1/PtL%i",level,level+2);         
01214             hptres[trig][level+1]->setAxisTitle(title, 1);
01215             sprintf(name,"HLTMuonL%itoL3_etares",level);
01216             sprintf(title,"L%iMuon#eta - L3Muon#eta",level);         
01217             hetares[trig][level+1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
01218             sprintf(title,"L%i #eta - L3 #eta",level);         
01219             hetares[trig][level+1]->setAxisTitle(title, 1);
01220             sprintf(name,"HLTMuonL%itoL3_phires",level);
01221             sprintf(title,"L%iMuon#phi - L3Muon#phi",level);         
01222             hphires[trig][level+1] =dbe_->book1D(name,title, NBINS, -0.1, 0.1);
01223             sprintf(title,"L%i #phi - L3 #phi",level);         
01224             hphires[trig][level+1]->setAxisTitle(title, 1);
01225 
01226             sprintf(name,"HLTMuonL%itoL3_ptrespt",level);
01227             sprintf(title,"L%i Muon #Delta Pt vs Pt (wrt L3) ",level);         
01228             hptrespt[trig][level+1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
01229             sprintf(title,"1/PtL%i - 1/PtL3",level);         
01230             hptrespt[trig][level+1]->setAxisTitle(title, 2);
01231             hptrespt[trig][level+1]->setAxisTitle("Pt", 1);
01232             sprintf(name,"HLTMuonL%itoL3_phiresphi",level);
01233             sprintf(title,"L%i Muon #Delta#phi vs #phi (wrt L3) ",level);         
01234             hphiresphi[trig][level+1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
01235             sprintf(title,"L%i #phi - L3 #phi",level);         
01236             hphiresphi[trig][level+1]->setAxisTitle(title, 2);
01237             hphiresphi[trig][level+1]->setAxisTitle("#phi", 1);
01238             sprintf(name,"HLTMuonL%itoL3_etareseta",level);
01239             sprintf(title,"L%i Muon #Delta#eta vs #eta (wrt L3) ",level);         
01240             hetareseta[trig][level+1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
01241             sprintf(title,"L%i #eta - L3 #eta",level);         
01242             hetareseta[trig][level+1]->setAxisTitle(title, 2);
01243             hetareseta[trig][level+1]->setAxisTitle("#eta", 1);
01244 
01245             // relres
01246             sprintf(name,"HLTMuonL%itoL3_ptrelres",level);
01247             sprintf(title,"(L%iMuon1/Pt - L%iMuon1/Pt)/(L%iMuon1/Pt)",level,level+2,level+2); 
01248             hptrelres[trig][level+1] = dbe_->book1D(name,title, NBINS, -1.0, 1.0);
01249             sprintf(title,"(1/PtL%i - 1/PtL3)/(1/PtL3)",level);         
01250             hptrelres[trig][level+1]->setAxisTitle(title, 1);
01251             sprintf(name,"HLTMuonL%itoL3_etarelres",level);
01252             sprintf(title,"(L%iMuon#eta - L3Muon#eta)/L3Muon#eta",level);         
01253             hetarelres[trig][level+1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
01254             sprintf(title,"(L%i #eta - L3 #eta)/L3 #eta",level);         
01255             hetarelres[trig][level+1]->setAxisTitle(title, 1);
01256             sprintf(name,"HLTMuonL%itoL3_phirelres",level);
01257             sprintf(title,"(L%iMuon#phi - L3Muon#phi)/L3Muon#phi",level);         
01258             hphirelres[trig][level+1] =dbe_->book1D(name,title, NBINS, -1.0, 1.0);
01259             sprintf(title,"(L%i #phi - L3 #phi)/L3 #phi",level);         
01260             hphirelres[trig][level+1]->setAxisTitle(title, 1);
01261 
01262             sprintf(name,"HLTMuonL%itoL3_ptrelrespt",level);
01263             sprintf(title,"L%i Muon #DeltaPt/Pt vs Pt (wrt L3) ",level);         
01264             hptrelrespt[trig][level+1] =dbe_->bookProfile(name,title, NBINS, 0, pt_max,1,-999.,999.,"s");
01265             sprintf(title,"(1/PtL%i - 1/PtL3)/(1/PtL3)",level);         
01266             hptrelrespt[trig][level+1]->setAxisTitle(title, 2);
01267             hptrelrespt[trig][level+1]->setAxisTitle("Pt", 1);
01268             sprintf(name,"HLTMuonL%itoL3_phirelresphi",level);
01269             sprintf(title,"L%i Muon #Delta#phi/#phi vs #phi (wrt L3) ",level);         
01270             hphirelresphi[trig][level+1] =dbe_->bookProfile(name,title, NBINS, -3.15, 3.15,1,-999.,999.,"s");
01271             sprintf(title,"(L%i #phi - L3 #phi)/L3 #phi",level);         
01272             hphirelresphi[trig][level+1]->setAxisTitle(title, 2);
01273             hphirelresphi[trig][level+1]->setAxisTitle("#phi", 1);
01274             sprintf(name,"HLTMuonL%itoL3_etarelreseta",level);
01275             sprintf(title,"L%i Muon #Delta#eta/#eta vs #eta (wrt L3) ",level);         
01276             hetarelreseta[trig][level+1] =dbe_->bookProfile(name,title, NBINS,-2.5, 2.5,1,-999.,999.,"s");
01277             sprintf(title,"(L%i #eta - L3 #eta)/L3 #eta",level);         
01278             hetarelreseta[trig][level+1]->setAxisTitle(title, 2);
01279             hetarelreseta[trig][level+1]->setAxisTitle("#eta", 1);
01280 
01281             sprintf(name,"HLTMuonL%itoL3_chargeconvers",level);
01282             sprintf(title,"L%i Muon charge #rightarrow L3 Muon charge",level);         
01283             hchargeconv[trig][level+1] =dbe_->book1D(name,title, 4, 0, 4);
01284             hchargeconv[trig][level+1]->setAxisTitle(title, 1);
01285             hchargeconv[trig][level+1]->setBinLabel(1, "- #rightarrow -", 1);
01286             hchargeconv[trig][level+1]->setBinLabel(2, "- #rightarrow +", 1);
01287             hchargeconv[trig][level+1]->setBinLabel(3, "+ #rightarrow -", 1);
01288             hchargeconv[trig][level+1]->setBinLabel(4, "+ #rightarrow +", 1);
01289           }
01290 
01291         }
01292       }
01293       if(verbose_)dbe_->showDirStructure();
01294     }
01295     // Muon det id is 2 pushed in bits 28:31
01296     const unsigned int detector_id = 2<<28;
01297     dbe_->tagContents(monitorName_, detector_id);
01298   } 
01299 
01300   for( int trig = 0; trig < nTrigs; trig++ ) {
01301     for( int level = 1; level < 3; ++level ) {
01302       char name[512];
01303 
01304       sprintf(name, "DenominatorL%iptTrig%i", level, trig);
01305       _hpt1[trig][level-1] = new TH1D(name, name, 40, 0, 145);
01306       sprintf(name, "NumeratorL%iptTrig%i", level, trig);
01307       _hpt2[trig][level-1] = new TH1D(name, name, 40, 0, 145);
01308       sprintf(name, "DenominatorL%ietaTrig%i", level, trig);
01309       _heta1[trig][level-1] = new TH1D(name, name, 40, -2.5, 2.5);
01310       sprintf(name, "NumeratorL%ietaTrig%i", level, trig);
01311       _heta2[trig][level-1] = new TH1D(name, name, 40, -2.5, 2.5);
01312       sprintf(name, "DenominatorL%iphiTrig%i", level, trig);
01313       _hphi1[trig][level-1] = new TH1D(name, name, 40, -3.15, 3.15);
01314       sprintf(name, "NumeratorL%iphiTrig%i", level, trig);
01315       _hphi2[trig][level-1] = new TH1D(name, name, 40, -3.15, 3.15);
01316 
01317     }
01318   }
01319 }
01320 
01321 //--------------------------------------------------------
01322 void HLTMuonDQMSource::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) {
01323 
01324 }
01325 
01326 //--------------------------------------------------------
01327 void HLTMuonDQMSource::beginLuminosityBlock(const edm::LuminosityBlock& leventSetupk, 
01328     const edm::EventSetup& eventSetup) {
01329 
01330 }
01331 
01332 // ----------------------------------------------------------
01333 void HLTMuonDQMSource::analyze(const edm::Event& event, 
01334     const edm::EventSetup& eventSetup )
01335 {  
01336   if ( !dbe_) return;
01337   counterEvt_++;
01338   if (prescaleEvt_ > 0 && counterEvt_%prescaleEvt_!=0) return;
01339   LogDebug("HLTMuonDQMSource") << " processing conterEvt_: " << counterEvt_ <<std::endl;
01340 
01341   bool trigFired = false;
01342   bool FiredTriggers[NTRIG] = {false};
01343   edm::Handle<edm::TriggerResults> trigResult;
01344   event.getByLabel(TrigResultInput, trigResult);
01345   if( !trigResult.failedToGet() ) {
01346     int ntrigs = trigResult->size();
01347     const edm::TriggerNames & trigName = event.triggerNames(*trigResult);
01348     for( int itrig = 0; itrig != ntrigs; ++itrig) {
01349       //std::cout << "trigName = " << trigName.triggerName(itrig) << " " << itrig << std::endl;
01350       for( unsigned int n = 0; n < (unsigned int)theTriggerBits.size(); n++) { 
01351         if( trigName.triggerIndex(theTriggerBits[n]) == (unsigned int)ntrigs ) continue;
01352         if( trigResult->accept(trigName.triggerIndex(theTriggerBits[n])) ) {
01353           for( unsigned int j = 0; j < (unsigned int)theDirectoryName.size(); j++ ) {
01354             if( theHLTCollectionLevel[n] == theDirectoryName[j] ) FiredTriggers[j] = true;
01355           }
01356           trigFired = true;
01357         }
01358       }
01359     }
01360   }
01361   //else std::cout << "failed to get trigResult!!" << std::endl;
01362   // trigger fired
01363   if( !trigFired ) return;
01364   nTrig_++;
01365 
01366   //get the field
01367   edm::ESHandle<MagneticField> magField;
01368   eventSetup.get<IdealMagneticFieldRecord>().get(magField);
01369 
01370   //get the geometry
01371   edm::ESHandle<GlobalTrackingGeometry> glbTrackingGeometry;
01372   eventSetup.get<GlobalTrackingGeometryRecord>().get(glbTrackingGeometry);
01373 
01374   edm::Handle<reco::RecoChargedCandidateCollection> l2mucands, l3mucands;
01375   edm::Handle<L2MuonTrajectorySeedCollection> l2seeds; 
01376   edm::Handle<L3MuonTrajectorySeedCollection> l3seeds; 
01377   reco::RecoChargedCandidateCollection::const_iterator cand, cand2, cand3;
01378 
01379   event.getByLabel (l2seedscollectionTag_,l2seeds);
01380   event.getByLabel (l3seedscollectionTag_,l3seeds);
01381   event.getByLabel (l2collectionTag_,l2mucands);
01382   event.getByLabel (l3collectionTag_,l3mucands);
01383 
01384   edm::Handle<L3MuonTrajectorySeedCollection> l3seedsOIState; 
01385   edm::Handle<L3MuonTrajectorySeedCollection> l3seedsOIHit; 
01386   edm::Handle<L3MuonTrajectorySeedCollection> l3seedsIOHit; 
01387   event.getByLabel (l3seedscollectionTagOIState_,l3seedsOIState);
01388   event.getByLabel (l3seedscollectionTagOIHit_,l3seedsOIHit);
01389   event.getByLabel (l3seedscollectionTagIOHit_,l3seedsIOHit);
01390 
01391   edm::Handle<std::vector<TrackCandidate> > l3trkCandsOIState;
01392   edm::Handle<std::vector<TrackCandidate> > l3trkCandsOIHit;
01393   edm::Handle<std::vector<TrackCandidate> > l3trkCandsIOHit;
01394   event.getByLabel (l3trkfindingOIState_,l3trkCandsOIState);
01395   event.getByLabel (l3trkfindingOIHit_,l3trkCandsOIHit);
01396   event.getByLabel (l3trkfindingIOHit_,l3trkCandsIOHit);
01397 
01398   edm::Handle<std::vector<reco::Track> > l3trkOIState;
01399   edm::Handle<std::vector<reco::Track> > l3trkOIHit;
01400   edm::Handle<std::vector<reco::Track> > l3trkIOHit;
01401   edm::Handle<std::vector<reco::Track> > l3tktrk;
01402   event.getByLabel (l3trkOIState_,l3trkOIState);
01403   event.getByLabel (l3trkOIHit_,l3trkOIHit);
01404   event.getByLabel (l3trkIOHit_,l3trkIOHit);
01405   event.getByLabel (l3tktrk_, l3tktrk);
01406 
01407 // 
01408   edm::Handle<std::vector<reco::Track> > l3muonOIState;
01409   edm::Handle<std::vector<reco::Track> > l3muonOIHit;
01410   edm::Handle<std::vector<reco::Track> > l3muonIOHit;
01411   edm::Handle<std::vector<reco::Track> > l3muon;
01412   event.getByLabel (l3muonsOIState_,l3muonOIState);
01413   event.getByLabel (l3muonsOIHit_,l3muonOIHit);
01414   event.getByLabel (l3muonsIOHit_,l3muonIOHit);
01415   event.getByLabel (l3muons_, l3muon);
01416 
01417 //  
01418   if( !l2seeds.failedToGet() && l2seeds.isValid() ) {
01419     event.getByLabel (l2collectionTag_,l2mucands);
01420     if( !l2mucands.failedToGet() && l2mucands->size() != 0 ) {
01421       event.getByLabel (l3seedscollectionTag_,l3seeds);
01422       if( !l3seeds.failedToGet() && l3seeds.isValid() ) event.getByLabel (l3collectionTag_,l3mucands);
01423     }
01424   }
01425   
01426   for( int ntrig = 0; ntrig < nTrigs; ntrig++ ) {
01427     if( !FiredTriggers[ntrig] ) continue;
01428     if( !l2seeds.failedToGet() && l2seeds.isValid() ) {
01429       hNMu[ntrig][3]->Fill(l2seeds->size());
01430       L2MuonTrajectorySeedCollection::const_iterator l2seed;
01431       std::map<l1extra::L1MuonParticleRef, int> l1map;
01432       for (l2seed=l2seeds->begin() ; l2seed != l2seeds->end();++l2seed){
01433         PTrajectoryStateOnDet state=l2seed->startingState();
01434         // Transform Trajectory State on Det to a TSOS
01435         TrajectoryStateTransform tsTransform;
01436         DetId seedDetId(state.detId());
01437         const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
01438         TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
01439         float pt = tsos.globalMomentum().perp();
01440         float eta = tsos.globalPosition().eta();
01441         float phi = tsos.globalPosition().phi();
01442         hcharge[ntrig][3]->Fill(tsos.charge());
01443         hpt[ntrig][3]->Fill(pt);
01444         hphi[ntrig][3]->Fill(phi);
01445         heta[ntrig][3]->Fill(eta);
01446         hetaphi[ntrig][3]->Fill(phi,eta);
01447         hptphi[ntrig][3]->Fill(pt,phi);
01448         hpteta[ntrig][3]->Fill(pt,eta);
01449         l1extra::L1MuonParticleRef l1ref = l2seed->l1Particle();
01450         l1map[l1ref]++;
01451         hseedptres[ntrig][0]->Fill(1/pt - 1/l1ref->pt());
01452         hseedetares[ntrig][0]->Fill(eta - l1ref->eta());
01453         hseedphires[ntrig][0]->Fill(phi - l1ref->phi());
01454         hseedptrelres[ntrig][0]->Fill((1/pt - 1/l1ref->pt())/(1/l1ref->pt()));
01455         hseedetarelres[ntrig][0]->Fill((eta - l1ref->eta())/l1ref->eta());
01456         hseedphirelres[ntrig][0]->Fill((phi - l1ref->phi())/l1ref->phi());
01457 
01458         hcharge[ntrig][0]->Fill(l1ref->charge());
01459         hpt[ntrig][0]->Fill(l1ref->pt());
01460         hphi[ntrig][0]->Fill(l1ref->phi());
01461 
01462         if(hphi[ntrig][0]->getEntries()){
01463           for(int ibin = 1; ibin <= hphi[ntrig][0]->getNbinsX(); ++ibin)
01464             hphi_norm[ntrig][0]->setBinContent(ibin, 
01465                 hphi[ntrig][0]->getBinContent(ibin)/hphi[ntrig][0]->getEntries());
01466         }
01467 
01468         heta[ntrig][0]->Fill(l1ref->eta());
01469         hetaphi[ntrig][0]->Fill(l1ref->phi(),l1ref->eta());
01470         hptphi[ntrig][0]->Fill(l1ref->pt(),l1ref->phi());
01471         hpteta[ntrig][0]->Fill(l1ref->pt(),l1ref->eta());
01472         hl1quality[ntrig]->Fill(l1ref->gmtMuonCand().quality());
01473         _hpt1[ntrig][0]->Fill(l1ref->pt());
01474         _heta1[ntrig][0]->Fill(l1ref->eta());
01475         _hphi1[ntrig][0]->Fill(l1ref->phi());
01476         if ( !l2mucands.failedToGet() && l2mucands.isValid() ) {
01477           for (cand=l2mucands->begin(); cand!=l2mucands->end(); ++cand) {
01478             reco::TrackRef tk = cand->get<reco::TrackRef>();
01479             edm::RefToBase<TrajectorySeed> seed=tk->seedRef();
01480             if ( (l2seed->startingState()).detId() == (seed->startingState()).detId() ) {
01481               if(tk->pt()*l1ref->pt() != 0 ) {
01482                 hptres[ntrig][0]->Fill(1/l1ref->pt() - 1/tk->pt());
01483                 hptrespt[ntrig][0]->Fill(tk->pt(), 1/l1ref->pt() - 1/tk->pt());
01484                 hptrelres[ntrig][0]->Fill((1/l1ref->pt() - 1/tk->pt())/(1/tk->pt()));
01485                 hptrelrespt[ntrig][0]->Fill(tk->pt(), (1/l1ref->pt() - 1/tk->pt())/(1/tk->pt()));
01486               }
01487               _hpt2[ntrig][0]->Fill(l1ref->pt());
01488               _heta2[ntrig][0]->Fill(l1ref->eta());
01489               _hphi2[ntrig][0]->Fill(l1ref->phi());
01490               hetares[ntrig][0]->Fill(l1ref->eta()-tk->eta());
01491               hetareseta[ntrig][0]->Fill(tk->eta(),l1ref->eta()-tk->eta());
01492               hetarelres[ntrig][0]->Fill((l1ref->eta()-tk->eta())/tk->eta());
01493               hetarelreseta[ntrig][0]->Fill(tk->eta(),(l1ref->eta()-tk->eta())/tk->eta());
01494               hphires[ntrig][0]->Fill(l1ref->phi()-tk->phi());
01495               double dphi=l1ref->phi()-tk->phi();
01496               if (dphi>TMath::TwoPi())dphi-=2*TMath::TwoPi();
01497               else if (dphi<-TMath::TwoPi()) dphi+=TMath::TwoPi();
01498               hphiresphi[ntrig][0]->Fill(tk->phi(),dphi);
01499               hphirelres[ntrig][0]->Fill((l1ref->phi()-tk->phi())/tk->phi());
01500               hphirelresphi[ntrig][0]->Fill(tk->phi(),dphi/tk->phi());
01501               // charge conversion
01502               int chargeconv = -1;
01503               int l1charge = l1ref->charge();
01504               int l2charge = tk->charge();
01505               if( l1charge == -1 && l2charge == -1 ) chargeconv = 0;
01506               else if( l1charge == -1 && l2charge == 1 ) chargeconv = 1;
01507               else if( l1charge == 1 && l2charge == -1 ) chargeconv = 2;
01508               else if( l1charge == 1 && l2charge == 1 ) chargeconv = 3;
01509               hchargeconv[ntrig][0]->Fill(chargeconv);
01510               _hpt1[ntrig][1]->Fill(tk->pt());
01511               _heta1[ntrig][1]->Fill(tk->eta());
01512               _hphi1[ntrig][1]->Fill(tk->phi());
01513               //find the L3 build from this L2
01514               if (!l3mucands.failedToGet() && l3mucands.isValid() ) {
01515                 for (cand=l3mucands->begin(); cand!=l3mucands->end(); ++cand) {
01516                   reco::TrackRef l3tk= cand->get<reco::TrackRef>();
01517                   if( l3tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> > ().isAvailable() ) {
01518                     if (l3tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >()->l2Track() == tk){
01519                       if(l1ref->pt()*l3tk->pt() != 0 ) {
01520                         hptres[ntrig][2]->Fill(1/l1ref->pt() - 1/l3tk->pt());
01521                         hptrespt[ntrig][2]->Fill(l3tk->pt(), 1/l1ref->pt() - 1/l3tk->pt());
01522                         hptrelres[ntrig][2]->Fill((1/l1ref->pt() - 1/l3tk->pt())/(1/l3tk->pt()));
01523                         hptrelrespt[ntrig][2]->Fill(l3tk->pt(), (1/l1ref->pt() - 1/l3tk->pt())/(1/l3tk->pt()));
01524                       }
01525                       hetares[ntrig][2]->Fill(l1ref->eta()-l3tk->eta());
01526                       hetareseta[ntrig][2]->Fill(l1ref->eta(),l1ref->eta()-l3tk->eta());
01527                       hetarelres[ntrig][2]->Fill((l1ref->eta()-l3tk->eta())/l3tk->eta());
01528                       hetarelreseta[ntrig][2]->Fill(l1ref->eta(),(l1ref->eta()-l3tk->eta())/l3tk->eta());
01529                       hphires[ntrig][2]->Fill(l1ref->phi()-l3tk->phi());
01530                       double dphi=l1ref->phi()-l3tk->phi();
01531                       if (dphi>TMath::TwoPi())dphi-=2*TMath::TwoPi();
01532                       else if (dphi<-TMath::TwoPi()) dphi+=TMath::TwoPi();
01533                       hphiresphi[ntrig][2]->Fill(l3tk->phi(),dphi);
01534                       hphirelres[ntrig][2]->Fill((l1ref->phi()-l3tk->phi())/l3tk->phi());
01535                       hphirelresphi[ntrig][2]->Fill(l3tk->phi(),(dphi)/l3tk->phi());
01536                       // charge conversion
01537                       int chargeconv = -1;
01538                       int l1charge = l1ref->charge();
01539                       int l3charge = l3tk->charge();
01540                       if( l1charge == -1 && l3charge == -1 ) chargeconv = 0;
01541                       else if( l1charge == -1 && l3charge == 1 ) chargeconv = 1;
01542                       else if( l1charge == 1 && l3charge == -1 ) chargeconv = 2;
01543                       else if( l1charge == 1 && l3charge == 1 ) chargeconv = 3;
01544                       hchargeconv[ntrig][2]->Fill(chargeconv);
01545                       _hpt2[ntrig][1]->Fill(tk->pt());
01546                       _heta2[ntrig][1]->Fill(tk->eta());
01547                       _hphi2[ntrig][1]->Fill(tk->phi());
01548                       //break; //plot only once per L2?
01549                     }//if
01550                   }
01551                 }//for
01552               }
01553               break;
01554             }
01555           }
01556         }
01557       }
01558       // mapping
01559       std::map<l1extra::L1MuonParticleRef, int>::iterator it;
01560       for( it = l1map.begin(); it != l1map.end(); it++ ) {
01561         hseedNMuper[ntrig][0]->Fill(it->second);
01562       }
01563       hNMu[ntrig][0]->Fill(l1map.size());
01564     }
01565 
01566     if (!l3seedsOIState.failedToGet() && l3seedsOIState.isValid() ) {
01567       hNMu_OIState[ntrig][4]->Fill(l3seedsOIState->size());
01568 
01569       L3MuonTrajectorySeedCollection::const_iterator l3seedOIState;
01570       for(l3seedOIState=l3seedsOIState->begin(); l3seedOIState != l3seedsOIState->end(); ++l3seedOIState){
01571         PTrajectoryStateOnDet state=l3seedOIState->startingState();
01572         TrajectoryStateTransform tsTransform;
01573         DetId seedDetId(state.detId());
01574         const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
01575         TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
01576 
01577         float pt = tsos.globalMomentum().perp();
01578         float eta = tsos.globalPosition().eta();
01579         float phi = tsos.globalPosition().phi();
01580 
01581         hNMu_l3seed_comp[ntrig][4]->Fill(1);
01582         hpt_OIState[ntrig][4]->Fill(pt);
01583         hphi_OIState[ntrig][4]->Fill(phi);
01584         heta_OIState[ntrig][4]->Fill(eta);
01585         hetaphi_OIState[ntrig][4]->Fill(phi,eta);
01586         hptphi_OIState[ntrig][4]->Fill(pt,phi);
01587         hpteta_OIState[ntrig][4]->Fill(pt,eta);
01588         hcharge_OIState[ntrig][4]->Fill(tsos.charge());
01589 
01590         //    reco::TrackRef tk = cand->get<reco::TrackRef>(); 
01591         //    hpt_OIState[ntrig][2]->Fill(tk->pt());
01592 
01593         // OIState track candidate
01594         //reco::TrackRef l2tkRef = l3seedOIState->l2Track();
01595       }
01596     }
01597 
01598     if ( !l3seedsOIHit.failedToGet() && l3seedsOIHit.isValid() && l3seedsOIHit->size() != 0 ) {
01599       hNMu_OIHit[ntrig][4]->Fill(l3seedsOIHit->size());
01600 
01601       L3MuonTrajectorySeedCollection::const_iterator l3seedOIHit;
01602       for(l3seedOIHit=l3seedsOIHit->begin(); l3seedOIHit != l3seedsOIHit->end(); ++l3seedOIHit){
01603         PTrajectoryStateOnDet state=l3seedOIHit->startingState();
01604         TrajectoryStateTransform tsTransform;
01605         DetId seedDetId(state.detId());
01606         const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
01607         TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
01608 
01609         float pt = tsos.globalMomentum().perp();
01610         float eta = tsos.globalPosition().eta();
01611         float phi = tsos.globalPosition().phi();
01612 
01613         hNMu_l3seed_comp[ntrig][4]->Fill(2);
01614         hpt_OIHit[ntrig][4]->Fill(pt);
01615         hphi_OIHit[ntrig][4]->Fill(phi);
01616         heta_OIHit[ntrig][4]->Fill(eta);
01617         hetaphi_OIHit[ntrig][4]->Fill(phi,eta);
01618         hptphi_OIHit[ntrig][4]->Fill(pt,phi);
01619         hpteta_OIHit[ntrig][4]->Fill(pt,eta);
01620         hcharge_OIHit[ntrig][4]->Fill(tsos.charge());
01621 
01622         //reco::TrackRef l2tkRef = l3seedOIHit->l2Track();
01623 //        std::cout << "== l3 cascade->l2tk muon pt : " << l2tkRef->pt() << "  eta : " << l2tkRef->eta() << "  phi : " << l2tkRef->phi() << std::endl;
01624       }
01625     }
01626 
01627     if ( !l3seedsIOHit.failedToGet() && l3seedsIOHit.isValid() && l3seedsIOHit->size() != 0 ) {
01628       hNMu_IOHit[ntrig][4]->Fill(l3seedsIOHit->size());
01629 
01630 
01631       L3MuonTrajectorySeedCollection::const_iterator l3seedIOHit;
01632       for(l3seedIOHit=l3seedsIOHit->begin(); l3seedIOHit != l3seedsIOHit->end(); ++l3seedIOHit){
01633         PTrajectoryStateOnDet state=l3seedIOHit->startingState();
01634         TrajectoryStateTransform tsTransform;
01635         DetId seedDetId(state.detId());
01636         const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
01637         TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
01638 
01639         float pt = tsos.globalMomentum().perp();
01640         float eta = tsos.globalPosition().eta();
01641         float phi = tsos.globalPosition().phi();
01642 
01643 
01644         hNMu_l3seed_comp[ntrig][4]->Fill(3);
01645         hpt_IOHit[ntrig][4]->Fill(pt);
01646         hphi_IOHit[ntrig][4]->Fill(phi);
01647         heta_IOHit[ntrig][4]->Fill(eta);
01648         hetaphi_IOHit[ntrig][4]->Fill(phi,eta);
01649         hptphi_IOHit[ntrig][4]->Fill(pt,phi);
01650         hpteta_IOHit[ntrig][4]->Fill(pt,eta);
01651         hcharge_IOHit[ntrig][4]->Fill(tsos.charge());
01652 
01653         //reco::TrackRef l2tkRef = l3seedIOHit->l2Track();
01654       }
01655     } 
01656 
01657 
01658     if (!l3seeds.failedToGet() && l3seeds.isValid() ) {
01659       hNMu[ntrig][4]->Fill(l3seeds->size());
01660       L3MuonTrajectorySeedCollection::const_iterator l3seed;
01661       std::map<reco::TrackRef, int> l2map;
01662       for (l3seed=l3seeds->begin() ; l3seed != l3seeds->end();++l3seed){
01663         PTrajectoryStateOnDet state=l3seed->startingState();
01664         // Transform Trajectory State on Det to a TSOS
01665         TrajectoryStateTransform tsTransform;
01666         DetId seedDetId(state.detId());
01667         const GeomDet* gdet = glbTrackingGeometry->idToDet( seedDetId );
01668         TrajectoryStateOnSurface tsos = tsTransform.transientState(state, &(gdet->surface()), magField.product());
01669 
01670         float pt = tsos.globalMomentum().perp();
01671         float eta = tsos.globalPosition().eta();
01672         float phi = tsos.globalPosition().phi();
01673 
01674 
01675         hNMu_l3seed_comp[ntrig][4]->Fill(0);
01676         hcharge[ntrig][4]->Fill(tsos.charge());
01677         hpt[ntrig][4]->Fill(pt);
01678         hphi[ntrig][4]->Fill(phi);
01679         heta[ntrig][4]->Fill(eta);
01680         hetaphi[ntrig][4]->Fill(phi,eta);
01681         hptphi[ntrig][4]->Fill(pt,phi);
01682         hpteta[ntrig][4]->Fill(pt,eta);
01683 
01684         reco::TrackRef l2tkRef = l3seed->l2Track();
01685 
01686         l2map[l2tkRef]++;
01687         hseedptres[ntrig][1]->Fill(1/pt - 1/l2tkRef->pt());
01688         hseedetares[ntrig][1]->Fill(eta - l2tkRef->eta());
01689         hseedphires[ntrig][1]->Fill(phi - l2tkRef->phi());
01690         hseedptrelres[ntrig][1]->Fill((1/pt - 1/l2tkRef->pt())/(1/l2tkRef->pt()));
01691         hseedetarelres[ntrig][1]->Fill((eta - l2tkRef->eta())/l2tkRef->eta());
01692         hseedphirelres[ntrig][1]->Fill((phi - l2tkRef->phi())/l2tkRef->phi());
01693       }
01694       // mapping
01695       std::map<reco::TrackRef, int>::iterator it;
01696       for( it = l2map.begin(); it != l2map.end(); it++ ) {
01697         hseedNMuper[ntrig][1]->Fill(it->second);
01698       }
01699     }
01700 
01701 
01702     reco::BeamSpot beamSpot;
01703     edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
01704     event.getByLabel("hltOnlineBeamSpot",recoBeamSpotHandle);
01705     if (!recoBeamSpotHandle.failedToGet())  beamSpot = *recoBeamSpotHandle;
01706 
01707     if (!l2mucands.failedToGet() && l2mucands.isValid() ) {
01708       LogDebug("HLTMuonDQMSource") << " filling L2 stuff " << std::endl;
01709       edm::Handle<reco::IsoDepositMap> l2depMap;
01710 
01711 
01712       if( l2mucands->size() != 0 ) event.getByLabel (l2isolationTag_,l2depMap);
01713       hNMu[ntrig][1]->Fill(l2mucands->size());
01714       for (cand=l2mucands->begin(); cand!=l2mucands->end(); ++cand) {
01715         reco::TrackRef tk = cand->get<reco::TrackRef>();
01716         if (!l2depMap.failedToGet() && l2depMap.isValid() ) {
01717           LogDebug("HLTMuonDQMSource") << " filling L2 Iso stuff " << std::endl;
01718           if ( tk.isNonnull() &&l2depMap->contains(tk.id()) ){
01719             reco::IsoDepositMap::value_type calDeposit = (*l2depMap)[tk];
01720             double dephlt = calDeposit.depositWithin(coneSize_);
01721             if( dephlt != 0 ) hisoL2[ntrig]->Fill(dephlt);
01722             // 2D plot: cone size vs. dep
01723             double depL2[10];
01724             for( int idep = 0; idep < 10; idep++ ) {
01725               double conesize = (idep + 1)*coneSize_/10.0;
01726               depL2[idep] = calDeposit.depositWithin(conesize);
01727               if( depL2[idep] != 0 ) hL2muonIsoDR[ntrig]->Fill(conesize, depL2[idep]);
01728             }
01729           }
01730         }
01731 
01732         // eta cut
01733         hpt[ntrig][1]->Fill(tk->pt());      
01734         hcharge[ntrig][1]->Fill(tk->charge()); 
01735         if ( tk->charge() != 0 ) {
01736           heta[ntrig][1]->Fill(tk->eta());      
01737           hphi[ntrig][1]->Fill(tk->phi()); 
01738 
01739 
01740           if(hphi[ntrig][1]->getEntries()){
01741             for(int ibin = 1; ibin <= hphi[ntrig][1]->getNbinsX(); ++ibin)
01742               hphi_norm[ntrig][1]->setBinContent(ibin, 
01743                   hphi[ntrig][1]->getBinContent(ibin)/hphi[ntrig][1]->getEntries());
01744           }
01745 
01746           hetaphi[ntrig][1]->Fill(tk->phi(),tk->eta()); 
01747           hptphi[ntrig][1]->Fill(tk->pt(),tk->phi()); 
01748           hpteta[ntrig][1]->Fill(tk->pt(),tk->eta()); 
01749           const reco::HitPattern& hitp = tk->hitPattern();
01750           hnHits[ntrig][1]->Fill(hitp.numberOfHits()); 
01751           hnValidHits[ntrig]->Fill(hitp.numberOfValidHits()); 
01752           hd0[ntrig][0]->Fill(tk->d0()); 
01753           if (!recoBeamSpotHandle.failedToGet()){
01754             hdr[ntrig][0]->Fill(tk->dxy(beamSpot.position()));  
01755             hdrphi[ntrig][0]->Fill(tk->phi(),tk->dxy(beamSpot.position())); 
01756             hdz[ntrig][0]->Fill(tk->dz(beamSpot.position())); 
01757             hdzeta[ntrig][0]->Fill(tk->eta(),tk->dz(beamSpot.position()));
01758           } 
01759           hd0phi[ntrig][0]->Fill(tk->phi(),tk->d0()); 
01760           hdz0[ntrig][0]->Fill(tk->dz()); 
01761           hdz0eta[ntrig][0]->Fill(tk->eta(),tk->dz());
01762           herr0[ntrig][0]->Fill(tk->error(0)); 
01763           cand2=cand;
01764           ++cand2;
01765           for (; cand2!=l2mucands->end(); cand2++) {
01766             reco::TrackRef tk2=cand2->get<reco::TrackRef>();
01767             if ( tk->charge()*tk2->charge() == -1 ){
01768               double mass=(cand->p4()+cand2->p4()).M();
01769               hdimumass[ntrig][0]->Fill(mass);
01770             }
01771           }
01772         } else edm::LogWarning("HLTMonMuon")<<"stop filling candidate with update@Vtx failure";
01773       }
01774     }
01775 
01776     if (!l3mucands.failedToGet() && l3mucands.isValid() ) {
01777       LogDebug("HLTMuonDQMSource") << " filling L3 stuff " << std::endl;
01778       hNMu[ntrig][2]->Fill(l3mucands->size());
01779       edm::Handle<reco::IsoDepositMap> l3depMap;
01780 
01781       if( l3mucands->size() != 0 ) event.getByLabel (l3isolationTag_,l3depMap);
01782       for (cand=l3mucands->begin(); cand!=l3mucands->end(); ++cand) {
01783         reco::TrackRef tk = cand->get<reco::TrackRef>();
01784         if (!l3depMap.failedToGet() && l3depMap.isValid() ) {
01785           if ( tk.isNonnull() && l3depMap->contains(tk.id()) ){
01786             reco::IsoDepositMap::value_type calDeposit= (*l3depMap)[tk];
01787             double dephlt = calDeposit.depositWithin(coneSize_);
01788             if( dephlt != 0 ) hisoL3[ntrig]->Fill(dephlt);
01789             double depL3[10];
01790             for( int idep = 0; idep < 10; idep++ ) {
01791               double conesize = ( idep + 1 ) * coneSize_/10.0;
01792               depL3[idep] = calDeposit.depositWithin(conesize);
01793               if( depL3[idep] != 0 ) hL3muonIsoDR[ntrig]->Fill(conesize,depL3[idep]);
01794             }
01795           }
01796         }
01797         // eta cut
01798         hpt[ntrig][2]->Fill(tk->pt());      
01799         heta[ntrig][2]->Fill(tk->eta());      
01800         hphi[ntrig][2]->Fill(tk->phi()); 
01801 
01802         if(hphi[ntrig][2]->getEntries()){
01803           for(int ibin = 1; ibin <= hphi[ntrig][2]->getNbinsX(); ++ibin)
01804             hphi_norm[ntrig][2]->setBinContent(ibin, 
01805                 hphi[ntrig][2]->getBinContent(ibin)/hphi[ntrig][2]->getEntries());
01806         }
01807 
01808         hetaphi[ntrig][2]->Fill(tk->phi(),tk->eta()); 
01809         hptphi[ntrig][2]->Fill(tk->pt(),tk->phi()); 
01810         hpteta[ntrig][2]->Fill(tk->pt(),tk->eta()); 
01811         const reco::HitPattern& hitp = tk->hitPattern();
01812         hnHits[ntrig][2]->Fill(hitp.numberOfHits()); 
01813         hnTkValidHits[ntrig]->Fill(hitp.numberOfValidTrackerHits()); 
01814         hnPixelValidHits[ntrig]->Fill(hitp.numberOfValidPixelHits()); 
01815         hnStripValidHits[ntrig]->Fill(hitp.numberOfValidStripHits()); 
01816         hnMuValidHits[ntrig]->Fill(hitp.numberOfValidMuonHits()); 
01817         hd0[ntrig][1]->Fill(tk->d0()); 
01818         if (!recoBeamSpotHandle.failedToGet()) {
01819           hdr[ntrig][1]->Fill(tk->dxy(beamSpot.position()));
01820           hdrphi[ntrig][1]->Fill(tk->phi(),tk->dxy(beamSpot.position())); 
01821           hdz[ntrig][1]->Fill(tk->dz(beamSpot.position())); 
01822           hdzeta[ntrig][1]->Fill(tk->eta(),tk->dz(beamSpot.position()));
01823         }
01824         hd0phi[ntrig][1]->Fill(tk->phi(),tk->d0()); 
01825         hdz0[ntrig][1]->Fill(tk->dz()); 
01826         hdz0eta[ntrig][1]->Fill(tk->eta(),tk->dz());
01827         herr0[ntrig][1]->Fill(tk->error(0)); 
01828         hcharge[ntrig][2]->Fill(tk->charge()); 
01829         cand2=cand;
01830         ++cand2;
01831 
01832         for (; cand2!=l3mucands->end(); cand2++) {
01833           reco::TrackRef tk2=cand2->get<reco::TrackRef>();
01834           if ( tk->charge()*tk2->charge() == -1 ){
01835             double mass=(cand->p4()+cand2->p4()).M();
01836             hdimumass[ntrig][1]->Fill(mass);
01837           }
01838         }
01839         if( tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >().isAvailable() ) {
01840           reco::TrackRef l2tk = tk->seedRef().castTo<edm::Ref<L3MuonTrajectorySeedCollection> >()->l2Track();
01841           if(tk->pt()*l2tk->pt() != 0 ) {
01842             hptres[ntrig][1]->Fill(1/l2tk->pt() - 1/tk->pt());
01843             hptrespt[ntrig][1]->Fill(tk->pt(), 1/l2tk->pt() - 1/tk->pt());
01844             hptrelres[ntrig][1]->Fill((1/l2tk->pt() - 1/tk->pt())/(1/tk->pt()));
01845             hptrelrespt[ntrig][1]->Fill(tk->pt(), (1/l2tk->pt() - 1/tk->pt())/(1/tk->pt()));
01846             double pterr = (tk->ptError()/(tk->pt()*tk->pt()));
01847             hptpull[ntrig]->Fill((1/l2tk->pt() - 1/tk->pt())/pterr);
01848             hptpullpt[ntrig]->Fill(tk->pt(), (1/l2tk->pt() - 1/tk->pt())/pterr);
01849           }
01850           hphires[ntrig][1]->Fill(l2tk->phi()-tk->phi());
01851           double dphi=l2tk->phi()-tk->phi();
01852           if (dphi>TMath::TwoPi())dphi-=2*TMath::TwoPi();
01853           else if (dphi<-TMath::TwoPi()) dphi+=TMath::TwoPi();
01854           hphiresphi[ntrig][1]->Fill(tk->phi(),dphi);
01855           hphirelres[ntrig][1]->Fill((l2tk->phi()-tk->phi())/tk->phi());
01856           hphirelresphi[ntrig][1]->Fill(tk->phi(),dphi/tk->phi());
01857           hphipull[ntrig]->Fill(dphi/tk->phiError());
01858           hphipullphi[ntrig]->Fill(tk->phi(), dphi/tk->phiError());
01859           hetares[ntrig][1]->Fill(l2tk->eta()-tk->eta());
01860           hetareseta[ntrig][1]->Fill(tk->eta(),l2tk->eta()-tk->eta());
01861           hetarelres[ntrig][1]->Fill((l2tk->eta()-tk->eta())/tk->eta());
01862           hetarelreseta[ntrig][1]->Fill(tk->eta(),(l2tk->eta()-tk->eta())/tk->eta());
01863           hetapull[ntrig]->Fill((l2tk->eta()-tk->eta())/tk->etaError());
01864           hetapulleta[ntrig]->Fill(tk->eta(),(l2tk->eta()-tk->eta())/tk->etaError());
01865           // charge conversion
01866           int chargeconv = -1;
01867           int l2charge = l2tk->charge();
01868           int l3charge = tk->charge();
01869           if( l2charge == -1 && l3charge == -1 ) chargeconv = 0;
01870           else if( l2charge == -1 && l3charge == 1 ) chargeconv = 1;
01871           else if( l2charge == 1 && l3charge == -1 ) chargeconv = 2;
01872           else if( l2charge == 1 && l3charge == 1 ) chargeconv = 3;
01873           hchargeconv[ntrig][1]->Fill(chargeconv);
01874         }
01875       }
01876     }
01877     // l3 matching
01878 
01879 //    std::vector<reco::Track>::const_iterator l3MatchedTrk = l3tktrk->end();
01880     double bpt = -999.;
01881     double beta = -999.;
01882     double bphi = -999.;
01883     if( !l3mucands.failedToGet() && l3mucands.isValid() ) {
01884       for(reco::RecoChargedCandidateCollection::const_iterator i = l3mucands->begin(); i != l3mucands->end(); i++ ) {
01885         double dR_min_tk=1e9;
01886         if( !l3tktrk.failedToGet() && l3tktrk.isValid() ) {
01887           for( std::vector<reco::Track>::const_iterator itl3trk = l3tktrk->begin(); itl3trk !=l3tktrk->end(); itl3trk++ ) {
01888             double dR = deltaR(i->eta(), i->phi(),itl3trk->eta(),itl3trk->phi());
01889             if( dR < dR_min_tk ) {
01890               dR_min_tk=dR ;
01891               bpt = itl3trk->pt();
01892               beta = itl3trk->eta();
01893               bphi = itl3trk->phi();
01894 //              l3MatchedTrk = itl3trk;
01895             }
01896           }
01897         }
01898         if( bpt !=-999 && beta != -999 && bphi != -999  ) {
01899           hptres_L3L3trk[ntrig][2]->Fill(1/i->pt() - 1/bpt);
01900           hetares_L3L3trk[ntrig][2]->Fill(i->eta() - beta);
01901           hphires_L3L3trk[ntrig][2]->Fill(i->phi() - bphi);
01902           hptrelres_L3L3trk[ntrig][2]->Fill( (1/i->pt() - 1/bpt)/(1/i->pt()) );
01903           hetarelres_L3L3trk[ntrig][2]->Fill( (i->eta() - beta)/i->eta() );
01904           hphirelres_L3L3trk[ntrig][2]->Fill( (i->phi() - bphi)/i->phi() );
01905         }
01906       }
01907     }
01908     std::vector<reco::Track>::const_iterator itl3mu;
01909     if( !l3muon.failedToGet() && l3muon.isValid() ) {
01910       for( itl3mu = l3muon->begin(); itl3mu != l3muon->end(); itl3mu++ ) {
01911         hNMu_comp[ntrig][2]->Fill(0);
01912       }
01913     }
01914 
01915     std::vector<reco::Track>::const_iterator itl3muOIState;
01916     if( !l3muonOIState.failedToGet() && l3muonOIState.isValid() && l3muonOIState->size() > 0 ) {
01917       hNMu_OIState[ntrig][2]->Fill(l3muonOIState->size());
01918       for( itl3muOIState = l3muonOIState->begin(); itl3muOIState != l3muonOIState->end(); itl3muOIState++ ) {
01919         hNMu_comp[ntrig][2]->Fill(1);
01920         hcharge_OIState[ntrig][2]->Fill(itl3muOIState->charge());
01921         hpt_OIState[ntrig][2]->Fill(itl3muOIState->pt());
01922         hphi_OIState[ntrig][2]->Fill(itl3muOIState->phi());
01923         heta_OIState[ntrig][2]->Fill(itl3muOIState->eta());
01924         hetaphi_OIState[ntrig][2]->Fill(itl3muOIState->phi(),itl3muOIState->eta());
01925         hptphi_OIState[ntrig][2]->Fill(itl3muOIState->pt(),itl3muOIState->phi());
01926         hpteta_OIState[ntrig][2]->Fill(itl3muOIState->pt(),itl3muOIState->eta());
01927 
01928         hd0_OIState[ntrig][2]->Fill(itl3muOIState->d0()); 
01929         if( !recoBeamSpotHandle.failedToGet()) {
01930           hdz_OIState[ntrig][2]->Fill(itl3muOIState->dz(beamSpot.position()));
01931           hdr_OIState[ntrig][2]->Fill(itl3muOIState->dxy(beamSpot.position()));
01932         }
01933        //hpt_l3muOIState[ntrig][2]->Fill(itl3muOIState->pt());
01934       }
01935     } 
01936     std::vector<reco::Track>::const_iterator itl3muOIHit;
01937     if( !l3muonOIHit.failedToGet() && l3muonOIHit.isValid() && l3muonOIHit->size() > 0 ) {
01938       hNMu_OIHit[ntrig][2]->Fill(l3muonOIHit->size());
01939       for( itl3muOIHit = l3muonOIHit->begin(); itl3muOIHit != l3muonOIHit->end(); itl3muOIHit++ ) {
01940         hNMu_comp[ntrig][2]->Fill(2);
01941         hcharge_OIHit[ntrig][2]->Fill(itl3muOIHit->charge());
01942         hpt_OIHit[ntrig][2]->Fill(itl3muOIHit->pt());
01943         hphi_OIHit[ntrig][2]->Fill(itl3muOIHit->phi());
01944         heta_OIHit[ntrig][2]->Fill(itl3muOIHit->eta());
01945         hetaphi_OIHit[ntrig][2]->Fill(itl3muOIHit->phi(),itl3muOIHit->eta());
01946         hptphi_OIHit[ntrig][2]->Fill(itl3muOIHit->pt(),itl3muOIHit->phi());
01947         hpteta_OIHit[ntrig][2]->Fill(itl3muOIHit->pt(),itl3muOIHit->eta());
01948 
01949         hd0_OIHit[ntrig][2]->Fill(itl3muOIHit->d0()); 
01950         if( !recoBeamSpotHandle.failedToGet()) {
01951           hdz_OIHit[ntrig][2]->Fill(itl3muOIHit->dz(beamSpot.position()));
01952           hdr_OIHit[ntrig][2]->Fill(itl3muOIHit->dxy(beamSpot.position()));
01953         }
01954        //hpt_l3muOIHit[ntrig][2]->Fill(itl3muOIHit->pt());
01955       }
01956     } 
01957     std::vector<reco::Track>::const_iterator itl3muIOHit;
01958     if( !l3muonIOHit.failedToGet() && l3muonIOHit.isValid() && l3muonIOHit->size() > 0 ) {
01959       hNMu_IOHit[ntrig][2]->Fill(l3muonIOHit->size());
01960       for( itl3muIOHit = l3muonIOHit->begin(); itl3muIOHit != l3muonIOHit->end(); itl3muIOHit++ ) {
01961         hNMu_comp[ntrig][2]->Fill(3);
01962         hcharge_IOHit[ntrig][2]->Fill(itl3muIOHit->charge());
01963         hpt_IOHit[ntrig][2]->Fill(itl3muIOHit->pt());
01964         hphi_IOHit[ntrig][2]->Fill(itl3muIOHit->phi());
01965         heta_IOHit[ntrig][2]->Fill(itl3muIOHit->eta());
01966         hetaphi_IOHit[ntrig][2]->Fill(itl3muIOHit->phi(),itl3muIOHit->eta());
01967         hptphi_IOHit[ntrig][2]->Fill(itl3muIOHit->pt(),itl3muIOHit->phi());
01968         hpteta_IOHit[ntrig][2]->Fill(itl3muIOHit->pt(),itl3muIOHit->eta());
01969 
01970         hd0_IOHit[ntrig][2]->Fill(itl3muIOHit->d0()); 
01971         if( !recoBeamSpotHandle.failedToGet()) {
01972           hdz_IOHit[ntrig][2]->Fill(itl3muIOHit->dz(beamSpot.position()));
01973           hdr_IOHit[ntrig][2]->Fill(itl3muIOHit->dxy(beamSpot.position()));
01974         }
01975       //hpt_l3muIOHit[ntrig][2]->Fill(itl3muIOHit->pt());
01976       }
01977     } 
01978     // l3 muon tracker track
01979     std::vector<reco::Track>::const_iterator itl3tktrk;
01980     if( l3tktrk.failedToGet() && l3tktrk.isValid() ) {
01981       hNMu_trk[ntrig][2]->Fill(l3tktrk->size());
01982       for( itl3tktrk = l3tktrk->begin(); itl3tktrk != l3tktrk->end(); itl3tktrk++ ) {
01983         hNMu_trk_comp[ntrig][2]->Fill(0);
01984         hcharge_trk[ntrig][2]->Fill(itl3tktrk->charge());
01985         hpt_trk[ntrig][2]->Fill(itl3tktrk->pt());
01986         hphi_trk[ntrig][2]->Fill(itl3tktrk->phi());
01987         heta_trk[ntrig][2]->Fill(itl3tktrk->eta());
01988         hetaphi_trk[ntrig][2]->Fill(itl3tktrk->phi(),itl3tktrk->eta());
01989         hptphi_trk[ntrig][2]->Fill(itl3tktrk->pt(),itl3tktrk->phi());
01990         hpteta_trk[ntrig][2]->Fill(itl3tktrk->pt(),itl3tktrk->eta());
01991 
01992         //hd0_trk[ntrig][2]->Fill(tk->d0()); 
01993         hd0_trk[ntrig][2]->Fill(itl3tktrk->d0()); 
01994         if( !recoBeamSpotHandle.failedToGet()) {
01995           hdz_trk[ntrig][2]->Fill(itl3tktrk->dz(beamSpot.position()));
01996           hdr_trk[ntrig][2]->Fill(itl3tktrk->dxy(beamSpot.position()));
01997         }
01998       }
01999     }
02000     // l3 OIState tracker info.
02001     std::vector<reco::Track>::const_iterator itl3trkOIState;
02002     if( !l3trkOIState.failedToGet() && l3trkOIState.isValid() && l3trkOIState->size() > 0 ) {
02003       hNMu_trk_OIState[ntrig][2]->Fill(l3trkOIState->size());
02004       for( itl3trkOIState = l3trkOIState->begin(); itl3trkOIState != l3trkOIState->end(); itl3trkOIState++ ) {
02005 
02006         hNMu_trk_comp[ntrig][2]->Fill(1);
02007         hcharge_trk_OIState[ntrig][2]->Fill(itl3trkOIState->charge());
02008         hpt_trk_OIState[ntrig][2]->Fill(itl3trkOIState->pt());
02009         hphi_trk_OIState[ntrig][2]->Fill(itl3trkOIState->phi());
02010         heta_trk_OIState[ntrig][2]->Fill(itl3trkOIState->eta());
02011         hetaphi_trk_OIState[ntrig][2]->Fill(itl3trkOIState->phi(),itl3trkOIState->eta());
02012         hptphi_trk_OIState[ntrig][2]->Fill(itl3trkOIState->pt(),itl3trkOIState->phi());
02013         hpteta_trk_OIState[ntrig][2]->Fill(itl3trkOIState->pt(),itl3trkOIState->eta());
02014 
02015         hd0_trk_OIState[ntrig][2]->Fill(itl3trkOIState->d0()); 
02016         if( !recoBeamSpotHandle.failedToGet()) {
02017           hdz_trk_OIState[ntrig][2]->Fill(itl3trkOIState->dz(beamSpot.position()));
02018           hdr_trk_OIState[ntrig][2]->Fill(itl3trkOIState->dxy(beamSpot.position()));
02019         }
02020       }
02021     }
02022     // l3 OIHit tracker info.
02023     std::vector<reco::Track>::const_iterator itl3trkOIHit;
02024     if( !l3trkOIHit.failedToGet() && l3trkOIHit.isValid() && l3trkOIHit->size() >0 ) {
02025       hNMu_trk_OIHit[ntrig][2]->Fill(l3trkOIHit->size());
02026       for( itl3trkOIHit = l3trkOIHit->begin(); itl3trkOIHit != l3trkOIHit->end(); itl3trkOIHit++ ) {
02027 
02028         hNMu_trk_comp[ntrig][2]->Fill(2);
02029         hcharge_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->charge());
02030         hpt_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->pt());
02031         hphi_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->phi());
02032         heta_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->eta());
02033         hetaphi_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->phi(),itl3trkOIHit->eta());
02034         hptphi_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->pt(),itl3trkOIHit->phi());
02035         hpteta_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->pt(),itl3trkOIHit->eta());
02036 
02037         hd0_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->d0()); 
02038         if( !recoBeamSpotHandle.failedToGet()) {
02039           hdz_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->dz(beamSpot.position()));
02040           hdr_trk_OIHit[ntrig][2]->Fill(itl3trkOIHit->dxy(beamSpot.position()));
02041         }
02042       }
02043     }
02044     // l3 IOHit tracker info.
02045     std::vector<reco::Track>::const_iterator itl3trkIOHit;
02046     if( !l3trkIOHit.failedToGet() && l3trkIOHit.isValid() && l3trkIOHit->size() > 0 ) {
02047       hNMu_trk_IOHit[ntrig][2]->Fill(l3trkIOHit->size());
02048       for( itl3trkIOHit = l3trkIOHit->begin(); itl3trkIOHit != l3trkIOHit->end(); itl3trkIOHit++ ) {
02049 
02050         hNMu_trk_comp[ntrig][2]->Fill(3);
02051         hcharge_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->charge());
02052         hpt_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->pt());
02053         hphi_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->phi());
02054         heta_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->eta());
02055         hetaphi_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->phi(),itl3trkIOHit->eta());
02056         hptphi_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->pt(),itl3trkIOHit->phi());
02057         hpteta_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->pt(),itl3trkIOHit->eta());
02058 
02059         hd0_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->d0()); 
02060         if( !recoBeamSpotHandle.failedToGet()) {
02061           hdr_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->dxy(beamSpot.position()));
02062           hdz_trk_IOHit[ntrig][2]->Fill(itl3trkIOHit->dz(beamSpot.position()));
02063         }
02064       }
02065     }
02066 
02067     for( int level = 0; level < 2; level++ ) {  
02068       for( int nbin = 1; nbin < _hpt1[ntrig][level]->GetNbinsX()+1; nbin++ ) {
02069         if( _hpt1[ntrig][level]->GetBinContent(nbin) != 0 ) {
02070           double frac = _hpt2[ntrig][level]->GetBinContent(nbin)/_hpt1[ntrig][level]->GetBinContent(nbin);
02071           double err = sqrt(frac*fabs(1 - frac)/_hpt1[ntrig][level]->GetBinContent(nbin));
02072           hptfrac[ntrig][level]->setBinContent(nbin, frac);
02073           hptfrac[ntrig][level]->setBinError(nbin, err);
02074         }
02075         if( _heta1[ntrig][level]->GetBinContent(nbin) != 0 ) {
02076           double frac = _heta2[ntrig][level]->GetBinContent(nbin)/_heta1[ntrig][level]->GetBinContent(nbin);
02077           double err = sqrt(frac*fabs(1 - frac)/_heta1[ntrig][level]->GetBinContent(nbin));
02078           hetafrac[ntrig][level]->setBinContent(nbin, frac);
02079           hetafrac[ntrig][level]->setBinError(nbin, err);
02080         }
02081         if( _hphi1[ntrig][level]->GetBinContent(nbin) != 0 ) {
02082           double frac = _hphi2[ntrig][level]->GetBinContent(nbin)/_hphi1[ntrig][level]->GetBinContent(nbin);
02083           double err = sqrt(frac*fabs(1 - frac)/_hphi1[ntrig][level]->GetBinContent(nbin));
02084           hphifrac[ntrig][level]->setBinContent(nbin, frac);
02085           hphifrac[ntrig][level]->setBinError(nbin, err);
02086         }
02087         else {
02088           hptfrac[ntrig][level]->setBinContent(nbin, 0.0);
02089           hetafrac[ntrig][level]->setBinContent(nbin, 0.0);
02090           hphifrac[ntrig][level]->setBinContent(nbin, 0.0);
02091           hptfrac[ntrig][level]->setBinError(nbin, 0.0);
02092           hetafrac[ntrig][level]->setBinError(nbin, 0.0);
02093           hphifrac[ntrig][level]->setBinError(nbin, 0.0);
02094         }
02095       }
02096     }
02097   }
02098 
02099 
02100   // Tower
02101   edm::Handle<CaloTowerCollection> caloTower; 
02102   if( !l2mucands.failedToGet() && l2mucands->size() != 0 )
02103     event.getByLabel(edm::InputTag("hltTowerMakerForMuons"), caloTower);
02104   for( int ntrig = 0; ntrig < nTrigs; ntrig++ ) {
02105     if( !FiredTriggers[ntrig] ) continue;
02106     if( caloTower.isValid() ) {
02107       CaloTowerCollection::const_iterator itower;
02108       for( itower = caloTower->begin(); itower != caloTower->end(); ++itower ) {
02109         if( (*itower).et() == 0 ) continue;
02110 
02111         // deltaR with l2muon
02112         if (!l2mucands.failedToGet() && l2mucands.isValid() ) {
02113           for (cand=l2mucands->begin(); cand!=l2mucands->end(); ++cand) {
02114             reco::TrackRef l2tk= cand->get<reco::TrackRef>();
02115             double deltaR_l2 = reco::deltaR(*l2tk, (*itower));
02116             htowerdRL2[ntrig]->Fill(deltaR_l2);
02117           }
02118         }
02119         // deltaR with l3muon
02120         if (!l3mucands.failedToGet() && l3mucands.isValid() ) {
02121           for (cand=l3mucands->begin(); cand!=l3mucands->end(); ++cand) {
02122             reco::TrackRef l3tk= cand->get<reco::TrackRef>();
02123             double deltaR_l3 = reco::deltaR(*l3tk, (*itower));
02124             htowerdRL3[ntrig]->Fill(deltaR_l3);
02125           }
02126         }
02127         htowerEt[ntrig]->Fill((*itower).et());
02128         htowerPhi[ntrig]->Fill((*itower).phi());
02129         htowerEta[ntrig]->Fill((*itower).eta());
02130 
02131         // energy contributions from different detectors
02132         // energy in HO ("outerEnergy")is not included in "hadEnergy"
02133         htowerOuterEnergy[ntrig]->Fill((*itower).outerEnergy());
02134         htowerHadEnergy[ntrig]->Fill((*itower).hadEnergy());
02135         htowerEmEnergy[ntrig]->Fill((*itower).emEnergy());
02136 
02137         htowerOuterEt[ntrig]->Fill((*itower).outerEt());
02138         htowerHadEt[ntrig]->Fill((*itower).hadEt());
02139         htowerEmEt[ntrig]->Fill((*itower).emEt());
02140 
02141         // 2D plots
02142         htowerPhiOuterEt[ntrig]->Fill((*itower).phi(), (*itower).outerEt());
02143         htowerPhiHadEt[ntrig]->Fill((*itower).phi(), (*itower).hadEt());
02144         htowerPhiEmEt[ntrig]->Fill((*itower).phi(), (*itower).emEt());
02145         htowerEtaOuterEt[ntrig]->Fill((*itower).eta(), (*itower).outerEt());
02146         htowerEtaHadEt[ntrig]->Fill((*itower).eta(), (*itower).hadEt());
02147         htowerEtaEmEt[ntrig]->Fill((*itower).eta(), (*itower).emEt());
02148       }
02149     }
02150   }
02151 }
02152 
02153 
02154 
02155 
02156 //--------------------------------------------------------
02157 void HLTMuonDQMSource::endLuminosityBlock(const edm::LuminosityBlock& lumiBlock, 
02158     const edm::EventSetup& eventSetup) {
02159 }
02160 //--------------------------------------------------------
02161 void HLTMuonDQMSource::endRun(const edm::Run& run, const edm::EventSetup& eventSetup){
02162 }
02163 //--------------------------------------------------------
02164 void HLTMuonDQMSource::endJob(){
02165   edm::LogInfo("HLTMonMuon") << "analyzed " << counterEvt_ << " events";
02166   //std::cout << "analyzed = " << counterEvt_ << " , triggered = " << nTrig_ << std::endl;
02167 
02168 
02169   //if (outputFile_.size() != 0 && dbe_)
02170   //dbe_->save(outputFile_);
02171 
02172   return;
02173 }