CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

L1TDTTF Class Reference

#include <L1TDTTF.h>

Inheritance diagram for L1TDTTF:
edm::EDAnalyzer

List of all members.

Public Member Functions

 L1TDTTF (const edm::ParameterSet &ps)
 base services
virtual ~L1TDTTF ()

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob (void)
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void endJob (void)
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)

Private Member Functions

void bookEta (int wh, int &nbins, float &start, float &stop)
void fillMEs (std::vector< L1MuDTTrackCand > *trackContainer, std::vector< L1MuRegionalCand > &gmtDttfCands)
void setQualLabel (MonitorElement *me, int axis)
void setWheelLabel (MonitorElement *me)

Private Attributes

DQMStoredbe_
MonitorElementdttf_bx [6][12]
MonitorElementdttf_bx_2ndTrack [6][12]
MonitorElementdttf_eta [6][12]
MonitorElementdttf_eta_fine_fraction [6][12]
MonitorElementdttf_eta_wheel_2ndTrack [6]
MonitorElementdttf_gmt_ghost
MonitorElementdttf_gmt_match
MonitorElementdttf_gmt_missed
MonitorElementdttf_nTracksPerEv [6][12]
MonitorElementdttf_nTracksPerEvent_integ
MonitorElementdttf_nTracksPerEvent_wheel [6]
MonitorElementdttf_phi [6][12]
MonitorElementdttf_phi_eta_coarse_wheel [6]
MonitorElementdttf_phi_eta_fine_wheel [6]
MonitorElementdttf_phi_eta_wheel_2ndTrack [6]
MonitorElementdttf_phi_wheel_2ndTrack [6]
MonitorElementdttf_pt [6][12]
MonitorElementdttf_pt_wheel_2ndTrack [6]
MonitorElementdttf_q [6][12]
MonitorElementdttf_q_wheel_2ndTrack [6]
MonitorElementdttf_qual [6][12]
MonitorElementdttf_quality_summary_wheel_2ndTrack [6]
MonitorElementdttf_quality_wheel_2ndTrack [6]
MonitorElementdttf_spare
edm::InputTag dttpgSource_
edm::InputTag gmtSource_
std::string l1tsubsystemfolder_
edm::InputTag muonCollectionLabel_
int nev_
int nev_dttf_
int nev_dttf_track2_
int numTracks [6][12]
bool online_
std::string outputFile_
edm::InputTag trackInputTag_
bool verbose_

Detailed Description

Definition at line 31 of file L1TDTTF.h.


Constructor & Destructor Documentation

L1TDTTF::L1TDTTF ( const edm::ParameterSet ps)

base services

DT input output tracks GMT GlobalMuon try

Verbose?

Use DQMStore?

Use ROOT Output?

Definition at line 205 of file L1TDTTF.cc.

References dbe_, dttpgSource_, edm::ParameterSet::getUntrackedParameter(), l1tsubsystemfolder_, edm::InputTag::label(), NULL, cppFunctionSkipper::operator, outputFile_, edm::InputTag::process(), DQMStore::setCurrentFolder(), DQMStore::setVerbose(), trackInputTag_, and verbose_.

  : dttpgSource_( ps.getParameter< edm::InputTag >("dttpgSource") ),
    gmtSource_( ps.getParameter< edm::InputTag >("gmtSource") ),
    muonCollectionLabel_( ps.getParameter<edm::InputTag>("MuonCollection") ),
    l1tsubsystemfolder_( ps.getUntrackedParameter<std::string>("l1tSystemFolder",
                                                               "L1T/L1TDTTF")),
    online_( ps.getUntrackedParameter<bool>("online", true) ),
    verbose_( ps.getUntrackedParameter<bool>("verbose", false) )

{

  std::string trstring =
    dttpgSource_.label() + ":DATA:" + dttpgSource_.process();
  trackInputTag_ = edm::InputTag(trstring);

  if ( verbose_ ) edm::LogInfo("L1TDTTF: constructor") << "Verbose enabled";

  dbe_ = NULL;
  if ( ps.getUntrackedParameter<bool>("DQMStore", false) ) {
    dbe_ = edm::Service<DQMStore>().operator->();
    dbe_->setVerbose(0);
    dbe_->setCurrentFolder(l1tsubsystemfolder_);
  }

  if ( ps.getUntrackedParameter<bool>("disableROOToutput", false) ) {

    outputFile_ = "";

  } else {

    outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
    if ( ! outputFile_.empty() ) {
      edm::LogInfo("L1TDTTF: constructor")
        << "L1T Monitoring histograms will be saved to " << outputFile_;
    }

  }

}
L1TDTTF::~L1TDTTF ( ) [virtual]

Nothing to destroy

Definition at line 251 of file L1TDTTF.cc.

{
}

Member Function Documentation

void L1TDTTF::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

counters

tracks handle

dttf counters

selection for offline

global muon selection plot

in case of problems accept all

in case of problems accept all

take only bx=0

in Gmt but not in DTTF

in phys values double phi= dttfCand->phiValue(); int sector = 1 + (phi + 15)/30; /// in phys values

Per event summaries

Implements edm::EDAnalyzer.

Definition at line 615 of file L1TDTTF.cc.

References accept(), dttf_gmt_ghost, dttf_nTracksPerEv, dttf_nTracksPerEvent_integ, dttf_nTracksPerEvent_wheel, dttf_spare, dttpgSource_, eta(), MonitorElement::Fill(), fillMEs(), L1MuGMTReadoutCollection::getRecords(), gmtSource_, edm::HandleBase::isValid(), edm::InputTag::label(), muonCollectionLabel_, patZpeak::muons, nev_, nev_dttf_, nev_dttf_track2_, numTracks, online_, phi, edm::InputTag::process(), edm::Handle< T >::product(), alignCSCRings::s, trackInputTag_, verbose_, and w().

{


  if ( verbose_ )
    edm::LogInfo("L1TDTTF::Analyze::start") << "#################### START";

  ++nev_;
  memset( numTracks, 0, 72 * sizeof(int) );

  edm::Handle<L1MuDTTrackContainer > myL1MuDTTrackContainer;
  try {
    event.getByLabel(trackInputTag_, myL1MuDTTrackContainer);
  } catch (...) {
    edm::LogError("L1TDTTF::analyze::DataNotFound")
      << "can't getByLabel L1MuDTTrackContainer with label " 
      << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
    return;
  }

  if ( !myL1MuDTTrackContainer.isValid() ) {
    edm::LogError("L1TDTTF::analyze::DataNotFound")
      << "can't find L1MuDTTrackContainer with label " 
      << dttpgSource_.label() << ":DATA:" << dttpgSource_.process();
    return;
  }

  L1MuDTTrackContainer::TrackContainer * trackContainer =
    myL1MuDTTrackContainer->getContainer();

  if ( trackContainer->size() > 0 ) {
    ++nev_dttf_;
    if( trackContainer->size() > 1 ) ++nev_dttf_track2_;
  }

  bool accept = true;
  if ( ! online_ ) {

    try {

      edm::Handle<reco::MuonCollection> muons;
      event.getByLabel(muonCollectionLabel_, muons);

      accept = false;
      if ( muons.isValid() ) {
        for (reco::MuonCollection::const_iterator recoMu = muons->begin();
             recoMu!=muons->end(); ++recoMu ) {
          if ( fabs( recoMu->eta() ) < 1.4 ) {
            if ( verbose_ ) {
              edm::LogInfo("L1TDTTFClient::Analyze:GM") << "Found a global muon!";
            }
            accept = true;
            break;
          }

        }

        if ( ! accept ) {
          dttf_spare->Fill( trackContainer->size() ? 1 : 0 );

          if ( verbose_ ) {
            edm::LogInfo("L1TDTTFClient::Analyze:GM")
              << "No global muons in this event!";
          }

        } else {
          dttf_spare->Fill( trackContainer->size() ? 2 : 3 );
        }

      } else {
        accept = true;
        edm::LogWarning("L1TDTTFClient::Analyze:GM")
          <<  "Invalid MuonCollection with label "
          << muonCollectionLabel_.label();
      }


    } catch (...) {
      accept = true;
      edm::LogError("DataNotFound") << "Unable to getByLabel MuonCollection with label "
                                    << muonCollectionLabel_.label() ;
    }

  }


  std::vector<L1MuRegionalCand> gmtBx0DttfCandidates;

  try {

    edm::Handle<L1MuGMTReadoutCollection> pCollection;
    event.getByLabel(gmtSource_, pCollection);

    if ( !pCollection.isValid() ) {
      edm::LogError("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
                                    << gmtSource_.label() ;
    }

    // get GMT readout collection
    L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
    std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();

    std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;

    for ( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr ) {
    
      std::vector<L1MuRegionalCand> dttfCands = RRItr->getDTBXCands();
      std::vector<L1MuRegionalCand>::iterator dttfCand;

      for( dttfCand = dttfCands.begin(); dttfCand != dttfCands.end();
           ++dttfCand ) {

        if(dttfCand->empty()) continue;
        if ( RRItr->getBxInEvent() ) continue;

        //       dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
        //                               dttfCand->phi_packed() );
        gmtBx0DttfCandidates.push_back( *dttfCand );

      }
    }

  } catch (...) {
    edm::LogError("DataNotFound") << "Unable to getByLabel L1MuGMTReadoutCollection with label "
                                  << gmtSource_.label() ;
  }


  // fill MEs if all selections are passed
  if ( accept ) fillMEs( trackContainer, gmtBx0DttfCandidates );

  std::vector<L1MuRegionalCand>::iterator dttfCand;
  for( dttfCand = gmtBx0DttfCandidates.begin();
       dttfCand != gmtBx0DttfCandidates.end(); ++dttfCand ) {
    if( dttfCand->empty() ) continue;

    int phi= dttfCand->phi_packed();
    int sector = 1 + (phi + 6)/12;
    if (sector > 12 ) sector -= 12;
    double eta = dttfCand->etaValue();

    int wheel = -3;
    if ( eta < -0.74 ) {
      wheel = -2;
    } else if ( eta < -0.3 ) {
      wheel = -1;

    } else if ( eta < 0.3 ) {
      wheel = 0;

    } else if ( eta < 0.74 ) {
      wheel = 1;
    } else {
      wheel = 2;
    }

    dttf_gmt_ghost->Fill( wheel, sector );
    // dttf_gmt_ghost_phys->Fill( dttfCand->eta_packed(),
    //                            dttfCand->phi_packed() );
  }


  int numTracksInt = 0;

  for ( int w = 0; w < 6; ++w ) {

    int numTracks_wh = 0;
    for ( int s = 0; s < 12; ++s ) {

      dttf_nTracksPerEv[w][s]->Fill( numTracks[w][s] );

      numTracks_wh += numTracks[w][s];

    }

    numTracksInt += numTracks_wh;
    dttf_nTracksPerEvent_wheel[w]->Fill( numTracks_wh );

  }

  dttf_nTracksPerEvent_integ->Fill( numTracksInt );



}
void L1TDTTF::beginJob ( void  ) [protected, virtual]

testing purposes

histo name

histo title

DTTF Output (6 wheels)

******************

Per wheel summaries

number of tracks per event per wheel

phi vs etafine - for each wheel

phi vs etacoarse - for each wheel

Per wheel summaries : 2ND_TRACK_ONLY

DTTF Tracks Quality distribution

quality per wheel 2ND TRACK

phi vs eta - for each wheel 2ND TRACK

DTTF Tracks eta distribution (Packed values)

DTTF Tracks Phi distribution (Packed values)

DTTF Tracks p_{T} distribution (Packed values)

DTTF Tracks Charge distribution

Go in detailed subfolders

number of tracks per event folder

BX_SECTORS for each wheel

CHARGE folder

PT folder

PHI folder

QUALITY folder

ETA folder

ETA folder

integrated values: always packed

Only for online: occupancy summary - reset

Reimplemented from edm::EDAnalyzer.

Definition at line 259 of file L1TDTTF.cc.

References DQMStore::book1D(), DQMStore::book2D(), bookEta(), dbe_, dttf_bx, dttf_bx_2ndTrack, dttf_eta, dttf_eta_fine_fraction, dttf_eta_wheel_2ndTrack, dttf_gmt_ghost, dttf_gmt_match, dttf_gmt_missed, dttf_nTracksPerEv, dttf_nTracksPerEvent_integ, dttf_nTracksPerEvent_wheel, dttf_phi, dttf_phi_eta_coarse_wheel, dttf_phi_eta_fine_wheel, dttf_phi_eta_wheel_2ndTrack, dttf_phi_wheel_2ndTrack, dttf_pt, dttf_pt_wheel_2ndTrack, dttf_q, dttf_q_wheel_2ndTrack, dttf_qual, dttf_quality_summary_wheel_2ndTrack, dttf_quality_wheel_2ndTrack, dttf_spare, MonitorElement::getTH2F(), l1tsubsystemfolder_, pileupCalc::nbins, nev_, nev_dttf_, nev_dttf_track2_, online_, MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), setQualLabel(), setWheelLabel(), and dqm_diff::start.

{
  nev_ = 0;
  nev_dttf_ = 0;
  nev_dttf_track2_ = 0;

  // get hold of back-end interface

  if ( dbe_ ) {

    std::string dttf_trk_folder = l1tsubsystemfolder_;

    char hname[100]; 
    char htitle[100]; 

    float start = 0;
    float stop = 0;
    int nbins = 0;

    dbe_->setCurrentFolder(dttf_trk_folder);

    std::string wheelpath[6] = { "/02-WHEEL_N2",
                                 "/03-WHEEL_N1",
                                 "/04-WHEEL_N0",
                                 "/05-WHEEL_P0",
                                 "/06-WHEEL_P1",
                                 "/07-WHEEL_P2" };


    char c_whn[6][3] = { "N2", "N1", "N0", "P0", "P1", "P2" };
    // char bxn [3][3] = { "N1", "0", "P1" };
    // char bxn[3][25] = {"/BX_NONZERO_ONLY/BX_N1", "", "/BX_NONZERO_ONLY/BX_P1"};

    for ( int iwh = 0; iwh < 6; ++iwh ) {

      bookEta( iwh, nbins, start, stop ); 

      std::string dttf_trk_folder_wheel = dttf_trk_folder + wheelpath[iwh];
      dbe_->setCurrentFolder(dttf_trk_folder_wheel);

      sprintf(hname, "dttf_01_nTracksPerEvent_wh%s", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - Number Tracks Per Event", c_whn[iwh]);
      dttf_nTracksPerEvent_wheel[iwh] = dbe_->book1D(hname, htitle,
                                                     10, 0.5, 10.5);
      dttf_nTracksPerEvent_wheel[iwh]->setAxisTitle("# tracks/event", 1);

      sprintf(hname, "dttf_07_phi_vs_etaFine_wh%s", c_whn[iwh]);
      sprintf(htitle, "Wheel %s -   #eta-#phi DTTF Tracks occupancy (fine #eta only, unpacked values)", c_whn[iwh]);
      dttf_phi_eta_fine_wheel[iwh] = dbe_->book2D(hname, htitle,
                                                  nbins, start-0.5, stop-0.5,
                                                  144, -6, 138);
      // 144, -0.5, 143.5);
      
      dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#eta", 1);
      dttf_phi_eta_fine_wheel[iwh]->setAxisTitle("#phi", 2);

      sprintf(hname, "dttf_08_phi_vs_etaCoarse_wh%s", c_whn[iwh]);
      sprintf(htitle, "Wheel %s -   #eta-#phi DTTF Tracks occupancy (coarse #eta only, unpacked values)", c_whn[iwh]);
      dttf_phi_eta_coarse_wheel[iwh] = dbe_->book2D(hname, htitle,
                                                    nbins, start-0.5, stop-0.5,
                                                    144, -6, 138);
      // 144, -0.5, 143.5);
      dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#eta", 1);
      dttf_phi_eta_coarse_wheel[iwh]->setAxisTitle("#phi", 2);

      std::string dttf_trk_folder_wheel_2ndtrack =
        dttf_trk_folder_wheel + "/2ND_TRACK_ONLY";
      dbe_->setCurrentFolder(dttf_trk_folder_wheel_2ndtrack);


      sprintf(hname, "dttf_04_quality_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - 2nd Tracks Quality distribution", c_whn[iwh]);
      dttf_quality_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 7, 1, 8);
      setQualLabel( dttf_quality_wheel_2ndTrack[iwh], 1);

      sprintf(hname, "dttf_05_quality_summary_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - 2nd Tracks - Quality", c_whn[iwh]);
      dttf_quality_summary_wheel_2ndTrack[iwh] = dbe_->book2D(hname, htitle,
                                                      12, 1, 13, 7, 1, 8 );
      dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Sector", 1);
      setQualLabel( dttf_quality_summary_wheel_2ndTrack[iwh], 2);
      // dttf_quality_summary_wheel_2ndTrack[iwh]->setAxisTitle("Quality", 2);

      sprintf(hname, "dttf_06_phi_vs_eta_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s -   #eta-#phi Distribution of DTTF 2nd Tracks",
              c_whn[iwh]);

      dttf_phi_eta_wheel_2ndTrack[iwh] = dbe_->book2D(hname, htitle,
                                                      nbins, start-0.5,stop-0.5,
                                                      144, -6, 138);
      // 144, -0.5, 143.5);
      dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);
      dttf_phi_eta_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 2);



      sprintf(hname, "dttf_07_eta_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - DTTF 2nd Tracks #eta distribution (Packed values)",
              c_whn[iwh]);
      dttf_eta_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 64, -0.5, 63.5);
      dttf_eta_wheel_2ndTrack[iwh]->setAxisTitle("#eta", 1);

      sprintf(hname, "dttf_08_phi_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Phi distribution (Packed values)",
              c_whn[iwh]);
      dttf_phi_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 144, -6, 138. );
      dttf_phi_wheel_2ndTrack[iwh]->setAxisTitle("#phi", 1);

      sprintf(hname, "dttf_09_pt_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - DTTF 2nd Tracks p_{T} distribution (Packed values)",
              c_whn[iwh]);
      dttf_pt_wheel_2ndTrack[iwh]  = dbe_->book1D(hname, htitle, 32, -0.5, 31.5);
      dttf_pt_wheel_2ndTrack[iwh]->setAxisTitle("p_{T}", 1);

      sprintf(hname, "dttf_10_charge_wh%s_2ndTrack", c_whn[iwh]);
      sprintf(htitle, "Wheel %s - DTTF 2nd Tracks Charge distribution", c_whn[iwh]);
      dttf_q_wheel_2ndTrack[iwh] = dbe_->book1D(hname, htitle, 2, -0.5, 1.5);
      dttf_q_wheel_2ndTrack[iwh]->setAxisTitle("Charge", 1);





      std::string dttf_trk_folder_nTracksPerEvent = dttf_trk_folder_wheel + "/TracksPerEvent";
      dbe_->setCurrentFolder(dttf_trk_folder_nTracksPerEvent);

      for(int ise = 0; ise < 12; ++ise) {
        sprintf(hname, "dttf_nTracksPerEvent_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Number of Tracks Per Event",
                c_whn[iwh], ise+1);
        dttf_nTracksPerEv[iwh][ise] = dbe_->book1D(hname, htitle, 2, 0.5, 2.5);
        dttf_nTracksPerEv[iwh][ise]->setAxisTitle("# tracks/event", 1);
      }


      std::string dttf_trk_folder_wh_bxsec_all =
        dttf_trk_folder_wheel + "/BX_BySector";
      dbe_->setCurrentFolder(dttf_trk_folder_wh_bxsec_all);

      for(int ise = 0; ise < 12; ++ise ) {
        sprintf(hname, "dttf_bx_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - BX Distribution",
                c_whn[iwh], ise+1);
        dttf_bx[iwh][ise] = dbe_->book1D(hname, htitle, 3, -1.5, 1.5);
        dttf_bx[iwh][ise]->setAxisTitle("BX", 1);
      }

      std::string dttf_trk_folder_wh_bxsec_trk2 =
        dttf_trk_folder_wheel + "/BX_BySector/2ND_TRACK_ONLY";
      dbe_->setCurrentFolder(dttf_trk_folder_wh_bxsec_trk2);

      for(int ise = 0; ise < 12; ++ise ) {
        sprintf(hname, "dttf_bx_2ndTrack_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - BX 2nd Tracks only",
                c_whn[iwh], ise+1);
        dttf_bx_2ndTrack[iwh][ise] = dbe_->book1D(hname, htitle, 3, -1.5, 1.5);
        dttf_bx_2ndTrack[iwh][ise]->setAxisTitle("BX", 1);
      }

      std::string dttf_trk_folder_charge = dttf_trk_folder_wheel + "/Charge";
      dbe_->setCurrentFolder(dttf_trk_folder_charge);

      for(int ise = 0; ise < 12; ++ise) {
        sprintf(hname, "dttf_charge_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Packed Charge", c_whn[iwh], ise+1);
        dttf_q[iwh][ise] = dbe_->book1D(hname, htitle, 2, -0.5, 1.5);
        dttf_q[iwh][ise]->setAxisTitle("Charge", 1);
      }

      std::string dttf_trk_folder_pt = dttf_trk_folder_wheel + "/PT";
      dbe_->setCurrentFolder(dttf_trk_folder_pt);

      for(int ise = 0; ise < 12; ++ise ) {
        sprintf(hname, "dttf_pt_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Packed p_{T}",
                c_whn[iwh], ise + 1 );
        dttf_pt[iwh][ise]= dbe_->book1D(hname, htitle, 32, -0.5, 31.5);
        dttf_pt[iwh][ise]->setAxisTitle("p_{T}", 1);
      }

      std::string dttf_trk_folder_phi = dttf_trk_folder_wheel + "/Phi";
      dbe_->setCurrentFolder(dttf_trk_folder_phi);

      for(int ise = 0; ise < 12; ++ise ) {
        sprintf(hname, "dttf_phi_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Packed Phi", c_whn[iwh], ise+1);
        dttf_phi[iwh][ise] = dbe_->book1D(hname, htitle, 144, -6, 138);
        dttf_phi[iwh][ise]->setAxisTitle("#phi", 1);
        //dttf_phi[iwh][ise] = dbe_->book1D(title,title, 32,-16.5, 15.5);
      }

      std::string dttf_trk_folder_quality = dttf_trk_folder_wheel + "/Quality";
      dbe_->setCurrentFolder(dttf_trk_folder_quality);

      for(int ise = 0; ise < 12; ++ise){
        sprintf(hname, "dttf_qual_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Packed Quality",
                c_whn[iwh], ise+1);
        dttf_qual[iwh][ise] = dbe_->book1D(hname, htitle, 7, 1, 8);
        dttf_qual[iwh][ise]->setAxisTitle("Quality", 1);
        setQualLabel( dttf_qual[iwh][ise], 1 );
      }

      std::string dttf_trk_folder_eta = dttf_trk_folder_wheel + "/Eta";
      dbe_->setCurrentFolder(dttf_trk_folder_eta);

      for (int ise = 0; ise < 12; ++ise ) {

        sprintf(hname, "dttf_eta_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Packed #eta",
                c_whn[iwh], ise+1);
        dttf_eta[iwh][ise] = dbe_->book1D(hname, htitle, 64, -0.5, 63.5);
        dttf_eta[iwh][ise]->setAxisTitle("#eta", 1);

      }

      dttf_trk_folder_eta = dttf_trk_folder_wheel + "/EtaFineFraction";
      dbe_->setCurrentFolder(dttf_trk_folder_eta);

      for (int ise = 0; ise < 12; ++ise ) {

        sprintf(hname, "dttf_etaFine_fraction_wh%s_se%d", c_whn[iwh], ise+1);
        sprintf(htitle, "Wheel %s Sector %d - Eta Fine Fraction",
                c_whn[iwh], ise+1);
        dttf_eta_fine_fraction[iwh][ise] = dbe_->book1D(hname, htitle, 2, 0, 2);
        dttf_eta_fine_fraction[iwh][ise]->setAxisTitle("#eta", 1);
        dttf_eta_fine_fraction[iwh][ise]->setBinLabel(1, "fine", 1);
        dttf_eta_fine_fraction[iwh][ise]->setBinLabel(2, "coarse", 1);

      }

    }

    std::string dttf_trk_folder_inclusive = dttf_trk_folder + "/01-INCLUSIVE";
    dbe_->setCurrentFolder(dttf_trk_folder_inclusive);


    sprintf(hname, "dttf_01_nTracksPerEvent_integ");
    sprintf(htitle, "Number of DTTF Tracks Per Event");
    dttf_nTracksPerEvent_integ = dbe_->book1D(hname, htitle, 20, 0.5, 20.5);
    dttf_nTracksPerEvent_integ->setAxisTitle("# tracks/event", 1);

    // sprintf(hname, "dttf_10_qual_eta_distr");
    // sprintf(htitle, "DTTF Tracks Quality vs Eta Distribution");
    // dttf_qual_eta_integ = dbe_->book2D(hname, htitle, 64, 0, 64, 7, 1, 8);
    // setQualLabel( dttf_qual_eta_integ, 2);

    if ( online_ ) {
      sprintf(hname, "dttf_04_tracks_occupancy_by_lumi");
      sprintf(htitle, "DTTF Tracks in the last LumiSections");
      dttf_spare = dbe_->book2D(hname, htitle, 6, 0, 6, 12, 1, 13);
      setWheelLabel( dttf_spare );
      dttf_spare->setAxisTitle("Sector", 2);
      dttf_spare->getTH2F()->GetXaxis()->SetNdivisions(12);
    } else {

      sprintf(hname, "dttf_04_global_muons_request");
      sprintf(htitle, "Tracks compatible with a Global Muon in the Barrel");
      dttf_spare = dbe_->book1D(hname, htitle, 4, -0.5, 3.5 );
      dttf_spare->setBinLabel(1, "No tracks", 1);
      dttf_spare->setBinLabel(2, "No tracks but GM", 1);
      dttf_spare->setBinLabel(3, "Tracks wo GM", 1);
      dttf_spare->setBinLabel(4, "Tracks w GM", 1);

    }

    std::string dttf_trk_folder_integrated_gmt =
      dttf_trk_folder + "/08-GMT_MATCH";
    dbe_->setCurrentFolder(dttf_trk_folder_integrated_gmt);

    sprintf(hname, "dttf_tracks_with_gmt_match");
    sprintf(htitle, "DTTF Tracks With a Match in GMT");
    dttf_gmt_match = dbe_->book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
    setWheelLabel( dttf_gmt_match );

    sprintf(hname, "dttf_tracks_without_gmt_match");
    sprintf(htitle, "DTTF Tracks Without a Match in GMT");
    dttf_gmt_missed = dbe_->book2D(hname, htitle, 6, 0., 6., 12, 1., 13.);
    setWheelLabel( dttf_gmt_missed );

    sprintf(hname, "dttf_missing_tracks_in_gmt");
    sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
    dttf_gmt_ghost = dbe_->book2D(hname, htitle, 5, -2, 3, 12, 1, 13.);

    dttf_gmt_ghost->setBinLabel(1, "N2", 1);
    dttf_gmt_ghost->setBinLabel(2, "N1", 1);
    dttf_gmt_ghost->setBinLabel(3, "N0/P0", 1);
    dttf_gmt_ghost->setBinLabel(4, "P1", 1);
    dttf_gmt_ghost->setBinLabel(5, "P2", 1);


    // sprintf(hname, "dttf_eta_phi_missing_tracks_in_gmt");
    // sprintf(htitle, "GMT Tracks Without a Corresponding Track in DTTF");
    // dttf_gmt_ghost_phys = dbe_->book2D(hname, htitle, 64, 0., 64., 144, 0., 144. );


  }

}
void L1TDTTF::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [inline, protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file L1TDTTF.h.

                                                         {};
void L1TDTTF::bookEta ( int  wh,
int &  nbins,
float &  start,
float &  stop 
) [private]

Definition at line 1050 of file L1TDTTF.cc.

Referenced by beginJob().

{

  switch ( wh ) {
  case 0 : start = 0;  stop = 18; nbins = 18; break; // N2
  case 1 : start = 8;  stop = 28; nbins = 20; break; // N1
  case 2 : start = 22; stop = 32; nbins = 10; break; // N0
  case 3 : start = 22; stop = 42; nbins = 20; break; // P0
  case 4 : start = 36; stop = 56; nbins = 20; break; // P1
  case 5 : start = 46; stop = 64; nbins = 18; break; // P2
  default : start = 0; stop = 0;  nbins = 0;  break; // BOH
  }

}
void L1TDTTF::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 597 of file L1TDTTF.cc.

References dbe_, nev_, nev_dttf_, nev_dttf_track2_, outputFile_, DQMStore::save(), and verbose_.

{
  if (verbose_) {
    edm::LogInfo("EndJob") << "L1TDTTF: end job....";
    edm::LogInfo("EndJob") << "analyzed " << nev_ << " events";
    edm::LogInfo("EndJob") << "containing at least one dttf track : "
                           << nev_dttf_;
    edm::LogInfo("EndJob") << "containing two dttf tracks : "
                           << nev_dttf_track2_;
  }
    
  if ( outputFile_.size() != 0  && dbe_ ) dbe_->save(outputFile_);

}
void L1TDTTF::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [inline, protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file L1TDTTF.h.

                                                       {};
void L1TDTTF::fillMEs ( std::vector< L1MuDTTrackCand > *  trackContainer,
std::vector< L1MuRegionalCand > &  gmtDttfCands 
) [private]

Forget N0 with zero eta value for physical values

from 0 to 11

from 1 to 12

wh has possible values {-3,-2,-1,1,2,3}

make wh2 go from 0 to 5

useful conversions

calculate phi in physical coordinates: keep it int, set labels later

new attempt

Fill per sector bx WHEEL_s/dttf_bx_whs

Fill per sector 2nd bx

WHEEL_s/BX_SECTORS/TRACK_2_ONLY/dttf_bx_2ndTrack_whs_sed

COUNTERS global

Fill per sector phi: WHEEL_s/BX_d/dttf_phi_whs_sed

Fill per sector quality WHEEL_s/BX_d/dttf_qual_whs_sed

Fill per sector pt WHEEL_s/BX_d/dttf_pt_whs_sed

Fill per sector charge WHEEL_s/BX_d/dttf_q_whs_sed

Fill per sector eta WHEEL_s/BX_d/dttf_eta_whs_sed

WHEEL_s/dttf_phi_eta_whs

WHEEL_s/dttf_phi_eta_whs

Only for online: INCLUSIVE/dttf_occupancy_summary_r

second track summary

WHEEL_s/dttf_phi_integ

WHEEL_s/dttf_pt_integ

WHEEL_s/dttf_eta_integ

WHEEL_s/dttf_qual_integ

WHEEL_s/dttf_q_integ

WHEEL_s/dttf_quality_whs

WHEEL_s/dttf_phi_eta_whs

gmt phi_packed() goes from 0 to 143

calculate phi in physical coordinates: keep it int, set labels later

Definition at line 822 of file L1TDTTF.cc.

References dttf_bx, dttf_bx_2ndTrack, dttf_eta, dttf_eta_fine_fraction, dttf_eta_wheel_2ndTrack, dttf_gmt_match, dttf_gmt_missed, dttf_phi, dttf_phi_eta_coarse_wheel, dttf_phi_eta_fine_wheel, dttf_phi_eta_wheel_2ndTrack, dttf_phi_wheel_2ndTrack, dttf_pt, dttf_pt_wheel_2ndTrack, dttf_q, dttf_q_wheel_2ndTrack, dttf_qual, dttf_quality_summary_wheel_2ndTrack, dttf_quality_wheel_2ndTrack, dttf_spare, MonitorElement::Fill(), match(), numTracks, online_, and verbose_.

Referenced by analyze().

{

  L1MuDTTrackContainer::TrackContainer::const_iterator track
    = trackContainer->begin();
  L1MuDTTrackContainer::TrackContainer::const_iterator trackEnd
    = trackContainer->end();

  for ( ; track != trackEnd; ++track ) {

    if ( verbose_ ) {
      edm::LogInfo("L1TDTTF::Analyze") << "bx = " << track->bx();
      edm::LogInfo("L1TDTTF::Analyze") << "quality (packed) = "
                                       << track->quality_packed();
      edm::LogInfo("L1TDTTF::Analyze") << "pt      (packed) = "
                                       << track->pt_packed()
                                       << "  , pt  (GeV) = " << track->ptValue();
      edm::LogInfo("L1TDTTF::Analyze") << "phi     (packed) = "
                                       << track->phi_packed()
                                       << " , phi (rad) = " << track->phiValue();
      edm::LogInfo("L1TDTTF::Analyze") << "charge  (packed) = "
                                       << track->charge_packed();
    }


    if ( ( track->whNum() == -1 ) && ! track->eta_packed() ) {
      edm::LogInfo("L1TDTTF::Analyze") << "Skipping N0 with zero eta value";

      continue;
    }


    int bxindex = track->bx() + 1;
    int se = track->scNum(); 
    int sector = se + 1; 
    int whindex = track->whNum(); 

    whindex = ( whindex < 0 ) ? whindex + 3 : whindex + 2; 

    if ( whindex < 0 || whindex > 5 ) {
      edm::LogError("L1TDTTF::Analyze::WHEEL_ERROR") << track->whNum()
                                                     << "(" << whindex << ")";
      continue;
    }

    if ( se < 0 || se > 11 ) {
      edm::LogError("L1TDTTF::Analyze::SECTOR_ERROR") << se;
      continue;
    }


    // int phi_local = track->phi_packed();//range: 0 < phi_local < 31
    // if ( phi_local > 15 ) phi_local -= 32; //range: -16 < phi_local < 15

    // int phi_global = phi_local + se * 12; //range: -16 < phi_global < 147
    // if(phi_global < 0) phi_global += 144; //range: 0 < phi_global < 147
    // if(phi_global > 143) phi_global -= 144; //range: 0 < phi_global < 143
    // // float phi_phys = phi_global * 2.5 + 1.25;

    int phi_global = track->phi_packed();
    phi_global =  (phi_global > 15 ? phi_global - 32 : phi_global ) + se * 12;
    if ( phi_global < -6 ) phi_global += 144; //range: 0 < phi_global < 147
    if ( phi_global > 137 ) phi_global -= 144; //range: 0 < phi_global < 143

    // int eta_global = track->eta_packed();
    // int eta_global = track->eta_packed() - 32;
    // dttf_eta[bxindex][whindex][se]->Fill(eta_global);
    // float eta_phys = eta_global / 2.4 ;


    dttf_bx[whindex][se]->Fill(track->bx());

    if( track->TrkTag() == 1 ) {

      dttf_bx_2ndTrack[whindex][se]->Fill(track->bx());

    }



    if ( bxindex == 1 ) {

      ++numTracks[whindex][se];

      dttf_phi[whindex][se]->Fill(phi_global);

      dttf_qual[whindex][se]->Fill(track->quality_packed());

      dttf_pt[whindex][se]->Fill(track->pt_packed());

      dttf_q[whindex][se]->Fill(track->charge_packed());


      dttf_eta[whindex][se]->Fill( track->eta_packed() );

      if( track->isFineHalo() ) {
        
        dttf_eta_fine_fraction[whindex][se]->Fill( 0 );

        dttf_phi_eta_fine_wheel[whindex]->Fill( track->eta_packed(), phi_global );

      } else {

        dttf_eta_fine_fraction[whindex][se]->Fill( 1 );

        dttf_phi_eta_coarse_wheel[whindex]->Fill( track->eta_packed(), phi_global );
      }

      if ( online_ ) {
        dttf_spare->Fill( whindex, sector );
      }

      // dttf_qual_eta_integ->Fill(track->eta_packed(), track->quality_packed());

      if ( track->TrkTag() == 1 ) {

        dttf_phi_wheel_2ndTrack[whindex]->Fill(phi_global);

        dttf_pt_wheel_2ndTrack[whindex]->Fill(track->pt_packed());

        dttf_eta_wheel_2ndTrack[whindex]->Fill(track->eta_packed());

        dttf_quality_wheel_2ndTrack[whindex]->Fill(track->quality_packed());

        dttf_q_wheel_2ndTrack[whindex]->Fill(track->charge_packed());

        dttf_quality_summary_wheel_2ndTrack[whindex]->Fill( sector, track->quality_packed() );

        dttf_phi_eta_wheel_2ndTrack[whindex]->Fill( track->eta_packed(), phi_global );

      }

      bool match = false;
      std::vector<L1MuRegionalCand>::iterator dttfCand;
      unsigned int gmt_phi = ( phi_global < 0 ? phi_global + 144 : phi_global );

      for ( dttfCand = gmtDttfCands.begin(); dttfCand != gmtDttfCands.end();
            ++dttfCand ) {

        if ( dttfCand->empty() ) continue;
        if ( ( dttfCand->phi_packed() == gmt_phi ) &&
             dttfCand->quality_packed() == track->quality_packed() ) {
          match = true;
          dttfCand->reset();
          break;
        }


      }

      if ( match ) {
        dttf_gmt_match->Fill( whindex, sector );
      } else {
        dttf_gmt_missed->Fill( whindex, sector );
      }

    }

  }

}
void L1TDTTF::setQualLabel ( MonitorElement me,
int  axis 
) [private]

Definition at line 1021 of file L1TDTTF.cc.

References MonitorElement::setAxisTitle(), and MonitorElement::setBinLabel().

Referenced by beginJob().

{

  if( axis == 1 )
    me->setAxisTitle("Quality", axis);
  me->setBinLabel(1, "T34", axis);
  me->setBinLabel(2, "T23/24", axis);
  me->setBinLabel(3, "T12/13/14", axis);
  me->setBinLabel(4, "T234", axis);
  me->setBinLabel(5, "T134", axis);
  me->setBinLabel(6, "T123/124", axis);
  me->setBinLabel(7, "T1234", axis);
}
void L1TDTTF::setWheelLabel ( MonitorElement me) [private]

Definition at line 1036 of file L1TDTTF.cc.

References MonitorElement::setAxisTitle(), and MonitorElement::setBinLabel().

Referenced by beginJob().

{
  me->setAxisTitle("Wheel", 1);
  me->setBinLabel(1, "N2", 1);
  me->setBinLabel(2, "N1", 1);
  me->setBinLabel(3, "N0", 1);
  me->setBinLabel(4, "P0", 1);
  me->setBinLabel(5, "P1", 1);
  me->setBinLabel(6, "P2", 1);
}

Member Data Documentation

DQMStore* L1TDTTF::dbe_ [private]

Definition at line 73 of file L1TDTTF.h.

Referenced by beginJob(), endJob(), and L1TDTTF().

MonitorElement* L1TDTTF::dttf_bx[6][12] [private]

Definition at line 89 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 90 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

MonitorElement* L1TDTTF::dttf_eta[6][12] [private]

Definition at line 93 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 92 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 83 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 103 of file L1TDTTF.h.

Referenced by analyze(), and beginJob().

Definition at line 101 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 102 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 88 of file L1TDTTF.h.

Referenced by analyze(), and beginJob().

Definition at line 98 of file L1TDTTF.h.

Referenced by analyze(), and beginJob().

Definition at line 77 of file L1TDTTF.h.

Referenced by analyze(), and beginJob().

MonitorElement* L1TDTTF::dttf_phi[6][12] [private]

Definition at line 94 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 81 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 80 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 82 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 84 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

MonitorElement* L1TDTTF::dttf_pt[6][12] [private]

Definition at line 95 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 85 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

MonitorElement* L1TDTTF::dttf_q[6][12] [private]

Definition at line 96 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 86 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 91 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 79 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 78 of file L1TDTTF.h.

Referenced by beginJob(), and fillMEs().

Definition at line 99 of file L1TDTTF.h.

Referenced by analyze(), beginJob(), and fillMEs().

Definition at line 67 of file L1TDTTF.h.

Referenced by analyze(), and L1TDTTF().

Definition at line 68 of file L1TDTTF.h.

Referenced by analyze().

std::string L1TDTTF::l1tsubsystemfolder_ [private]

Definition at line 70 of file L1TDTTF.h.

Referenced by beginJob(), and L1TDTTF().

Definition at line 69 of file L1TDTTF.h.

Referenced by analyze().

int L1TDTTF::nev_ [private]

Definition at line 106 of file L1TDTTF.h.

Referenced by analyze(), beginJob(), and endJob().

int L1TDTTF::nev_dttf_ [private]

Definition at line 107 of file L1TDTTF.h.

Referenced by analyze(), beginJob(), and endJob().

Definition at line 108 of file L1TDTTF.h.

Referenced by analyze(), beginJob(), and endJob().

int L1TDTTF::numTracks[6][12] [private]

Definition at line 109 of file L1TDTTF.h.

Referenced by analyze(), and fillMEs().

bool L1TDTTF::online_ [private]

Definition at line 71 of file L1TDTTF.h.

Referenced by analyze(), beginJob(), and fillMEs().

std::string L1TDTTF::outputFile_ [private]

Definition at line 74 of file L1TDTTF.h.

Referenced by endJob(), and L1TDTTF().

Definition at line 75 of file L1TDTTF.h.

Referenced by analyze(), and L1TDTTF().

bool L1TDTTF::verbose_ [private]

Definition at line 72 of file L1TDTTF.h.

Referenced by analyze(), endJob(), fillMEs(), and L1TDTTF().