CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

L1TRPCTPG Class Reference

Data Format. More...

#include <L1TRPCTPG.h>

Inheritance diagram for L1TRPCTPG:
edm::EDAnalyzer

List of all members.

Public Member Functions

std::map< std::string,
MonitorElement * > 
L1TRPCBookME (RPCDetId &detId)
 Booking of MonitoringElemnt for one RPCDetId (= roll)
 L1TRPCTPG (const edm::ParameterSet &ps)
virtual ~L1TRPCTPG ()

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
void beginJob (void)
void endJob (void)

Private Attributes

DQMStoredbe
ofstream logFile_
MonitorElementm_digiBxCSC
MonitorElementm_digiBxDT
MonitorElementm_digiBxRPCBar
MonitorElementm_digiBxRPCEnd
bool monitorDaemon_
int nev_
std::string outputFile_
edm::InputTag rpctfSource_
MonitorElementrpctpgbx
std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
rpctpgmeCollection
MonitorElementrpctpgndigi [3]
edm::InputTag rpctpgSource_
bool verbose_

Detailed Description

Data Format.

Geometry

Definition at line 55 of file L1TRPCTPG.h.


Constructor & Destructor Documentation

L1TRPCTPG::L1TRPCTPG ( const edm::ParameterSet ps)

Definition at line 22 of file L1TRPCTPG.cc.

References gather_cfg::cout, dbe, edm::ParameterSet::getUntrackedParameter(), NULL, cppFunctionSkipper::operator, outputFile_, DQMStore::setCurrentFolder(), DQMStore::setVerbose(), and verbose_.

  : rpctpgSource_( ps.getParameter< InputTag >("rpctpgSource") ),
    rpctfSource_( ps.getParameter< InputTag >("rpctfSource") )
{

  // verbosity switch
  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);

  if(verbose_) cout << "L1TRPCTPG: constructor...." << endl;


  dbe = NULL;
  if ( ps.getUntrackedParameter<bool>("DQMStore", false) ) 
  {
    dbe = Service<DQMStore>().operator->();
    dbe->setVerbose(0);
  }

  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
  if ( outputFile_.size() != 0 ) {
    cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
  }

  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
  if(disable){
    outputFile_="";
  }


  if ( dbe !=NULL ) {
    dbe->setCurrentFolder("L1T/L1TRPCTPG");
  }


}
L1TRPCTPG::~L1TRPCTPG ( ) [virtual]

Definition at line 58 of file L1TRPCTPG.cc.

{
}

Member Function Documentation

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

RPC Geometry

DIGI

Implements edm::EDAnalyzer.

Definition at line 117 of file L1TRPCTPG.cc.

References gather_cfg::cout, MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByLabel(), L1MuGMTReadoutCollection::getRecords(), edm::HandleBase::isValid(), edm::ESHandleBase::isValid(), edm::InputTag::label(), m_digiBxCSC, m_digiBxDT, m_digiBxRPCBar, m_digiBxRPCEnd, nev_, edm::Handle< T >::product(), rpctfSource_, rpctpgbx, rpctpgndigi, rpctpgSource_, edm::second(), and verbose_.

{
  nev_++; 
  if(verbose_) cout << "L1TRPCTPG: analyze...." << endl;

  
  edm::ESHandle<RPCGeometry> rpcGeo;
  c.get<MuonGeometryRecord>().get(rpcGeo);
  if (!rpcGeo.isValid()) {
    edm::LogInfo("DataNotFound") << "can't find RPCGeometry" << endl;
    return;
  }
//   char layerLabel[328];
//   char meId [328];
 

  edm::Handle<RPCDigiCollection> rpcdigis;
  e.getByLabel(rpctpgSource_,rpcdigis);
    
  if (!rpcdigis.isValid()) {
    edm::LogInfo("DataNotFound") << "can't find RPCDigiCollection with label "<< rpctpgSource_ << endl;
    return;
  }

  // Calculate the number of DT and CSC cands present
  edm::Handle<L1MuGMTReadoutCollection> pCollection;
  e.getByLabel(rpctfSource_,pCollection);
  
  if (!pCollection.isValid()) {
     edm::LogInfo("DataNotFound") << "can't find L1MuGMTReadoutCollection with label "
           << rpctfSource_.label() ;
     return;
  }
  
  L1MuGMTReadoutCollection const* gmtrc = pCollection.product();
  vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
  vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
  
  static int nRPCTrackBarrel, nRPCTrackEndcap , nDTTrack, nCSCTrack;
  nRPCTrackBarrel = 0;
  nRPCTrackEndcap = 0;
  nDTTrack = 0;
  nCSCTrack = 0;

  for( RRItr = gmt_records.begin() ;
       RRItr != gmt_records.end() ;
       RRItr++ )
  {
     // DTs
     vector<L1MuRegionalCand> DTCands = RRItr->getDTBXCands();
     for( vector<L1MuRegionalCand>::const_iterator
          ECItr = DTCands.begin() ;
          ECItr != DTCands.end() ;
          ++ECItr )
     {
        if (!ECItr->empty()) { ++nDTTrack; }
     }
      // CSCs
     vector<L1MuRegionalCand> CSCCands = RRItr->getCSCCands();
     for( vector<L1MuRegionalCand>::const_iterator
          ECItr = CSCCands.begin() ;
          ECItr != CSCCands.end() ;
          ++ECItr )
     {
        if (!ECItr->empty()) { ++nCSCTrack; }
     }

     //RPC barrel
     vector<L1MuRegionalCand> RPCBCands = RRItr->getBrlRPCCands();
     for( vector<L1MuRegionalCand>::const_iterator
          ECItr = RPCBCands.begin() ;
          ECItr != RPCBCands.end() ;
          ++ECItr )
     {
        if (!ECItr->empty()) { ++nRPCTrackBarrel; }
     }

     //RPC endcap
     vector<L1MuRegionalCand> RPCECands = RRItr->getFwdRPCCands();
     for( vector<L1MuRegionalCand>::const_iterator
          ECItr = RPCECands.begin() ;
          ECItr != RPCECands.end() ;
          ++ECItr )
     {
        if (!ECItr->empty()) { ++nRPCTrackEndcap; }
     }
  }

    int numberofDigi[3] = {0,0,0};
    

  RPCDigiCollection::DigiRangeIterator collectionItr;
  for(collectionItr=rpcdigis->begin(); collectionItr!=rpcdigis->end(); ++collectionItr){

    /*RPCDetId detId=(*collectionItr ).first; 

    
    uint32_t id=detId();
    char detUnitLabel[328];
    RPCGeomServ RPCname(detId);
    std::string nameRoll = RPCname.name();
    sprintf(detUnitLabel ,"%s",nameRoll.c_str());
    sprintf(layerLabel ,"%s",nameRoll.c_str());
    std::map<uint32_t, std::map<std::string,MonitorElement*> >::iterator meItr = rpctpgmeCollection.find(id);
    if (meItr == rpctpgmeCollection.end() || (rpctpgmeCollection.size()==0)) {
      rpctpgmeCollection[id]=L1TRPCBookME(detId);
    }
    std::map<std::string, MonitorElement*> meMap=rpctpgmeCollection[id];*/
    

//      std::vector<int> strips;
//      std::vector<int> bxs;
//      strips.clear(); 
//      bxs.clear();
     RPCDigiCollection::const_iterator digiItr; 
     for (digiItr = ((*collectionItr ).second).first;
          digiItr!=((*collectionItr).second).second; ++digiItr){
       
       // strips is a list of hit strips (regardless of bx) for this roll
//        int strip= (*digiItr).strip();
//        strips.push_back(strip);
       int bx=(*digiItr).bx();
       rpctpgbx->Fill(bx);
       //

       if ( nRPCTrackBarrel == 0 &&  nDTTrack != 0) {
          m_digiBxDT->Fill(bx);
       } else if ( nRPCTrackBarrel != 0 &&  nDTTrack == 0) {
          m_digiBxRPCBar->Fill(bx);
       }

       if ( nRPCTrackEndcap == 0 &&  nCSCTrack != 0) {
          m_digiBxCSC->Fill(bx);
       } else if ( nRPCTrackEndcap != 0 &&  nCSCTrack == 0) {
          m_digiBxRPCEnd->Fill(bx);
       }




       
       if (bx == -1) 
       {
        numberofDigi[0]++;
       }
       if (bx == 0) 
       { 
//         sprintf(meId,"Occupancy_%s",detUnitLabel);
//      meMap[meId]->Fill(strip);
        numberofDigi[1]++;
       }
       if (bx == 2) 
       {
        numberofDigi[2]++;
       }
       
//        sprintf(meId,"BXN_%s",detUnitLabel);
//        meMap[meId]->Fill(bx);
//        sprintf(meId,"BXN_vs_strip_%s",detUnitLabel);
//        meMap[meId]->Fill(strip,bx);
      
     }
  }

      rpctpgndigi[0]->Fill(numberofDigi[0]);
      rpctpgndigi[1]->Fill(numberofDigi[1]);
      rpctpgndigi[2]->Fill(numberofDigi[2]);

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

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file L1TRPCTPG.cc.

References DQMStore::book1D(), dbe, m_digiBxCSC, m_digiBxDT, m_digiBxRPCBar, m_digiBxRPCEnd, nev_, cppFunctionSkipper::operator, DQMStore::rmdir(), rpctpgbx, rpctpgndigi, and DQMStore::setCurrentFolder().

{

  nev_ = 0;

  // get hold of back-end interface
  DQMStore* dbe = 0;
  dbe = Service<DQMStore>().operator->();

  if ( dbe ) {
    dbe->setCurrentFolder("L1T/L1TRPCTPG");
    dbe->rmdir("L1T/L1TRPCTPG");
  }


  if ( dbe ) 
  {
    dbe->setCurrentFolder("L1T/L1TRPCTPG");
    rpctpgbx = dbe->book1D("RPCTPG_bx", 
       "RPC digis bx - all events", 9, -4.5, 4.5 ) ;
    
    rpctpgndigi[1] = dbe->book1D("RPCTPG_ndigi", 
       "RPCTPG nDigi bx 0", 100, -0.5, 99.5 ) ;
    rpctpgndigi[2] = dbe->book1D("RPCTPG_ndigi_+1", 
       "RPCTPG nDigi bx +1", 100, -0.5, 99.5 ) ;
    rpctpgndigi[0] = dbe->book1D("RPCTPG_ndigi_-1", 
       "RPCTPG nDigi bx -1", 100, -0.5, 99.5 ) ;



    m_digiBxRPCBar = dbe->book1D("RPCDigiRPCBmu_noDTmu_bx",
       "RPC digis bx - RPC, !DT", 9, -4.5, 4.5 ) ;

    m_digiBxRPCEnd = dbe->book1D("RPCDigiRPCEmu_noCSCmu_bx",
         "RPC digis bx - RPC, !CSC", 9, -4.5, 4.5 ) ;

    m_digiBxDT = dbe->book1D("RPCDigiDTmu_noRPCBmu_bx",
         "RPC digis bx - !RPC, DT", 9, -4.5, 4.5 ) ;

    m_digiBxCSC = dbe->book1D("RPCDigiCSCmu_noRPCEmu_bx",
         "RPC digis bx - !RPC, CSC", 9, -4.5, 4.5 ) ;
   }  
}
void L1TRPCTPG::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file L1TRPCTPG.cc.

References gather_cfg::cout, dbe, nev_, outputFile_, DQMStore::save(), and verbose_.

{
  if(verbose_) cout << "L1TRPCTPG: end job...." << endl;
  LogInfo("EndJob") << "analyzed " << nev_ << " events"; 

 if ( outputFile_.size() != 0  && dbe ) dbe->save(outputFile_);

 return;
}
std::map< std::string, MonitorElement * > L1TRPCTPG::L1TRPCBookME ( RPCDetId detId)

Booking of MonitoringElemnt for one RPCDetId (= roll)

Name components common to current RPDDetId

Definition at line 23 of file L1TRPCBookME.cc.

References RPCGeomServ::name(), RPCDetId::region(), RPCDetId::ring(), RPCDetId::sector(), RPCDetId::station(), and AlCaHLTBitMon_QueryRunRegistry::string.

                                           {
    
    std::map<std::string, MonitorElement*> meMap;


    std::string regionName;
    std::string ringType;
    if(detId.region() ==  0) {
      regionName="Barrel";
      ringType="Wheel";
    }else{
      ringType="Disk";
      if(detId.region() == -1) regionName="Encap-";
      if(detId.region() ==  1) regionName="Encap+";
    }
    
    char  folder[220];
    sprintf(folder,"L1T/L1TRPCTPG/Strips/%s/%s_%d/station_%d/sector_%d",
     regionName.c_str(),ringType.c_str(),
     detId.ring(),detId.station(),detId.sector());
    //cout << folder << endl;
    dbe->setCurrentFolder(folder);
    
    char detUnitLabel[328];
    char layerLabel[328];
    
  //sprintf(detUnitLabel ,"%d",detId());
    RPCGeomServ RPCname(detId);
    std::string nameRoll = RPCname.name();
    sprintf(detUnitLabel ,"%s",nameRoll.c_str());
    sprintf(layerLabel ,"%s",nameRoll.c_str());
    
    char meId [328];
    char meTitle [328];
    
    
 // Begin booking
     sprintf(meId,"Occupancy_%s",detUnitLabel);
     sprintf(meTitle,"Occupancy_for_%s",layerLabel);
     //   cout << meId << endl;
     //   cout << meTitle << endl; 
     meMap[meId] = dbe->book1D(meId, meTitle, 100, 0.5, 100.5);
      
     sprintf(meId,"BXN_%s",detUnitLabel);
     sprintf(meTitle,"BXN_for_%s",layerLabel);
     meMap[meId] = dbe->book1D(meId, meTitle, 11, -10.5, 10.5);
      
     sprintf(meId,"BXN_vs_strip_%s",detUnitLabel);
     sprintf(meTitle,"BXN_vs_strip_for_%s",layerLabel);
     meMap[meId] = dbe->book2D(meId, meTitle,  100, 0.5, 100.5, 11, -10.5, 10.5);
      
    return meMap;
  }

Member Data Documentation

Definition at line 80 of file L1TRPCTPG.h.

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

ofstream L1TRPCTPG::logFile_ [private]

Definition at line 99 of file L1TRPCTPG.h.

Definition at line 91 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

Definition at line 89 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

Definition at line 85 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

Definition at line 87 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

bool L1TRPCTPG::monitorDaemon_ [private]

Definition at line 98 of file L1TRPCTPG.h.

int L1TRPCTPG::nev_ [private]

Definition at line 95 of file L1TRPCTPG.h.

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

std::string L1TRPCTPG::outputFile_ [private]

Definition at line 96 of file L1TRPCTPG.h.

Referenced by endJob(), and L1TRPCTPG().

Definition at line 101 of file L1TRPCTPG.h.

Referenced by analyze().

Definition at line 83 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

std::map<uint32_t, std::map<std::string, MonitorElement*> > L1TRPCTPG::rpctpgmeCollection [private]

Definition at line 93 of file L1TRPCTPG.h.

Definition at line 82 of file L1TRPCTPG.h.

Referenced by analyze(), and beginJob().

Definition at line 100 of file L1TRPCTPG.h.

Referenced by analyze().

bool L1TRPCTPG::verbose_ [private]

Definition at line 97 of file L1TRPCTPG.h.

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