CMS 3D CMS Logo

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

DTLocalTriggerLutTask Class Reference

#include <DTLocalTriggerLutTask.h>

Inheritance diagram for DTLocalTriggerLutTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DTLocalTriggerLutTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~DTLocalTriggerLutTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob ()
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 To reset the MEs.
void beginRun (const edm::Run &, const edm::EventSetup &)
 BeginRun.
void endJob (void)
 EndJob.
void searchDccBest (std::vector< L1MuDTChambPhDigi > *trigs)
 Find best (highest qual) DCC trigger segments.

Private Member Functions

void bookHistos (DTChamberId chId)
 Book histos.
std::string & topFolder ()
 Get the top folder.

Private Attributes

std::string baseFolder
std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
chHistos
DQMStoredbe
edm::InputTag dccInputTag
bool detailedAnalysis
edm::ESHandle< DTGeometrymuonGeom
int nEvents
int nLumis
int nPhibBins
int nPhiBins
bool overUnderIn
edm::ParameterSet parameters
double rangePhi
double rangePhiB
edm::InputTag segInputTag
std::string theGeomLabel
bool track_ok [6][5][15]
const L1MuDTChambPhDigitrigBest [6][5][13]
DTTrigGeomUtilstrigGeomUtils
int trigQualBest [6][5][13]
std::map< int, std::map
< std::string, MonitorElement * > > 
whHistos

Friends

class DTMonitorModule

Detailed Description

Definition at line 41 of file DTLocalTriggerLutTask.h.


Constructor & Destructor Documentation

DTLocalTriggerLutTask::DTLocalTriggerLutTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 38 of file DTLocalTriggerLutTask.cc.

References baseFolder, dbe, dccInputTag, detailedAnalysis, edm::ParameterSet::getUntrackedParameter(), LogTrace, nPhibBins, nPhiBins, cppFunctionSkipper::operator, overUnderIn, parameters, rangePhi, rangePhiB, segInputTag, and theGeomLabel.

                                                                      : trigGeomUtils(0) {
        
  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: Constructor"<<endl;
        
  dccInputTag  = ps.getUntrackedParameter<InputTag>("inputTagDCC");
  segInputTag  = ps.getUntrackedParameter<InputTag>("inputTagSEG");

  overUnderIn      = ps.getUntrackedParameter<bool>("rebinOutFlowsInGraph");
  detailedAnalysis = ps.getUntrackedParameter<bool>("detailedAnalysis");
  theGeomLabel     = ps.getUntrackedParameter<string>("geomLabel");
  
  if (detailedAnalysis){
    nPhiBins  = 401;
    rangePhi  = 10.025;
    nPhibBins = 401;
    rangePhiB = 10.025;
  } else {
    nPhiBins  = 51;
    rangePhi  = 5.1;
    nPhibBins = 51;
    rangePhiB = 10.2;
  }
  
  baseFolder = "DT/03-LocalTrigger-DCC/";
  parameters = ps;
  dbe = edm::Service<DQMStore>().operator->();  
        
}
DTLocalTriggerLutTask::~DTLocalTriggerLutTask ( ) [virtual]

Destructor.

Definition at line 68 of file DTLocalTriggerLutTask.cc.

References LogTrace, nEvents, and trigGeomUtils.

                                              {
  
  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: analyzed " << nEvents << " events" << endl;
  if (trigGeomUtils) { delete trigGeomUtils; }
        
}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 166 of file DTLocalTriggerLutTask.cc.

References chHistos, DTTrigGeomUtils::computeSCCoordinates(), dccInputTag, DTRecSegment2D::degreesOfFreedom(), detailedAnalysis, edm::Event::getByLabel(), max(), min, nEvents, overUnderIn, DTRecSegment4D::phiSegment(), rangePhi, rangePhiB, DetId::rawId(), searchDccBest(), segInputTag, relativeConstraints::station, DTChamberId::station(), trigBest, DTTrigGeomUtils::trigDir(), trigGeomUtils, DTTrigGeomUtils::trigPos(), trigQualBest, DTTrigGeomUtils::trigToSeg(), and DTChamberId::wheel().

                                                                            {
        
  nEvents++;
    
  edm::Handle<L1MuDTChambPhContainer> trigHandle;
  e.getByLabel(dccInputTag,trigHandle);
  vector<L1MuDTChambPhDigi>* trigs = trigHandle->getContainer();
  searchDccBest(trigs);

  Handle<DTRecSegment4DCollection> segments4D;
  e.getByLabel(segInputTag,segments4D);                 
  DTRecSegment4DCollection::id_iterator chamberId;

  // Preliminary loop finds best 4D Segment and high quality ones
  vector<const DTRecSegment4D*> best4DSegments;
  
  for (chamberId = segments4D->id_begin(); chamberId != segments4D->id_end(); ++chamberId){
                
    DTRecSegment4DCollection::range  rangeInCh = segments4D->get(*chamberId);
    DTRecSegment4DCollection::const_iterator trackIt  = rangeInCh.first;
    DTRecSegment4DCollection::const_iterator trackEnd = rangeInCh.second;

    const DTRecSegment4D* tmpBest = 0;
    int tmpdof = 0;
    int dof = 0;
    
    for (; trackIt!=trackEnd; ++trackIt){
                        
      if(trackIt->hasPhi()) {                           
        dof = trackIt->phiSegment()->degreesOfFreedom();
        if (dof>tmpdof) {
          tmpBest = &(*trackIt);
          tmpdof = dof; 
        }
      }
 
    }

    if (tmpBest) best4DSegments.push_back(tmpBest);
  
  }

  vector<const DTRecSegment4D*>::const_iterator bestTrackIt  = best4DSegments.begin();
  vector<const DTRecSegment4D*>::const_iterator bestTrackEnd = best4DSegments.end();
  
  for (; bestTrackIt!=bestTrackEnd; ++bestTrackIt) {
    
    if((*bestTrackIt)->hasPhi()) {
      
      DTChamberId chId = (*bestTrackIt)->chamberId();
      int nHitsPhi = (*bestTrackIt)->phiSegment()->degreesOfFreedom()+2;
      
      int wheel    = chId.wheel();
      int station  = chId.station();
      int scsector = 0;
      float trackPosPhi, trackPosEta, trackDirPhi, trackDirEta;
      trigGeomUtils->computeSCCoordinates((*bestTrackIt),scsector,trackPosPhi,trackDirPhi,trackPosEta,trackDirEta);
      
      map<string, MonitorElement*> &chMap = chHistos[chId.rawId()];

      if (trigQualBest[wheel+3][station][scsector] > 3 &&  // residuals only for correlate triggers
          trigQualBest[wheel+3][station][scsector] < 7 &&
          nHitsPhi>=7 ) {
                                        
        float trigPos = trigGeomUtils->trigPos(trigBest[wheel+3][station][scsector]);
        float trigDir = trigGeomUtils->trigDir(trigBest[wheel+3][station][scsector]);
        trigGeomUtils->trigToSeg(station,trigPos,trackDirPhi);
                                                                                
        double deltaPos = trigPos-trackPosPhi;
        deltaPos = overUnderIn ? max(min(deltaPos,rangePhi-0.01),-rangePhi+0.01) : deltaPos;
        double deltaDir = trigDir-trackDirPhi;
        deltaDir = overUnderIn ? max(min(deltaDir,rangePhiB-0.01),-rangePhiB+0.01) : deltaDir;
        chMap.find("DCC_PhiResidual")->second->Fill(deltaPos);
        chMap.find("DCC_PhibResidual")->second->Fill(deltaDir);

        if (detailedAnalysis){
          chMap.find("DCC_PhitkvsPhitrig")->second->Fill(trigPos,trackPosPhi);
          chMap.find("DCC_PhibtkvsPhibtrig")->second->Fill(trigDir,trackDirPhi);
          chMap.find("DCC_PhibResidualvsTkPos")->second->Fill(trackPosPhi,trigDir-trackDirPhi);
          chMap.find("DCC_PhiResidualvsTkPos")->second->Fill(trackPosPhi,trigPos-trackPosPhi);
        }

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

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file DTLocalTriggerLutTask.cc.

References LogTrace, nEvents, and nLumis.

                                    {
        
  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: BeginJob" << endl;
  nEvents = 0;
  nLumis  = 0;
        
}
void DTLocalTriggerLutTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

To reset the MEs.

Reimplemented from edm::EDAnalyzer.

Definition at line 134 of file DTLocalTriggerLutTask.cc.

References chHistos, edm::ParameterSet::getUntrackedParameter(), LogTrace, nLumis, and parameters.

                                                                                                          {

  nLumis++;
  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: Begin of LS transition" << endl;
  
  if(nLumis%parameters.getUntrackedParameter<int>("ResetCycle") == 0) {
 
    LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: Cleaning histos" << endl;
    map<uint32_t, map<string, MonitorElement*> > ::const_iterator chambIt  = chHistos.begin();
    map<uint32_t, map<string, MonitorElement*> > ::const_iterator chambEnd = chHistos.end();
 
    for(; chambIt!=chambEnd; ++chambIt) {
      map<string, MonitorElement*> ::const_iterator histoIt  = chambIt->second.begin();
      map<string, MonitorElement*> ::const_iterator histoEnd = chambIt->second.end();
      for(; histoIt!=histoEnd; ++ histoIt) {
        histoIt->second->Reset();
      }
    }

  }
        
}
void DTLocalTriggerLutTask::beginRun ( const edm::Run run,
const edm::EventSetup context 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file DTLocalTriggerLutTask.cc.

References bookHistos(), edm::EventSetup::get(), LogTrace, muonGeom, theGeomLabel, and trigGeomUtils.

                                                                                    {
        
  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: BeginRun" << endl;   
        
  context.get<MuonGeometryRecord>().get(theGeomLabel,muonGeom);
  trigGeomUtils = new DTTrigGeomUtils(muonGeom);
        
  std::vector<DTChamber*>::const_iterator chambIt  = muonGeom->chambers().begin();
  std::vector<DTChamber*>::const_iterator chambEnd = muonGeom->chambers().end();
  
  for (; chambIt!=chambEnd; ++chambIt)
    bookHistos((*chambIt)->id());

}
void DTLocalTriggerLutTask::bookHistos ( DTChamberId  chId) [private]

Book histos.

Definition at line 84 of file DTLocalTriggerLutTask.cc.

References DQMStore::book1D(), DQMStore::book2D(), chHistos, dbe, detailedAnalysis, nPhibBins, nPhiBins, rangePhi, rangePhiB, DetId::rawId(), DTChamberId::sector(), DQMStore::setCurrentFolder(), relativeConstraints::station, DTChamberId::station(), topFolder(), and DTChamberId::wheel().

Referenced by beginRun().

                                                       {

  stringstream wheel; wheel << chId.wheel();    
  stringstream sector; sector << chId.sector();
  stringstream station; station << chId.station();      

  dbe->setCurrentFolder(topFolder() + "Wheel" + wheel.str() + "/Sector" + sector.str() +
                        "/Station" + station.str() + "/Segment");
  
  string chTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
  std::map<std::string, MonitorElement*> &chambMap = chHistos[chId.rawId()];

  string hName = "DCC_PhiResidual";
  chambMap[hName] = dbe->book1D(hName+chTag,"Trigger local position - Segment local position (correlated triggers)",nPhiBins,-rangePhi,rangePhi); 
  hName = "DCC_PhibResidual";
  chambMap[hName] =dbe->book1D(hName+chTag,"Trigger local direction - Segment local direction (correlated triggers)",nPhibBins,-rangePhiB,rangePhiB);

  if (detailedAnalysis) {

    hName = "DCC_PhitkvsPhitrig";
    chambMap[hName] = dbe->book2D(hName+chTag,"Local position: segment vs trigger",100,-500.,500.,100,-500.,500.);    
    hName = "DCC_PhibtkvsPhibtrig";
    chambMap[hName] =dbe->book2D(hName+chTag,"Local direction : segment vs trigger",200,-40.,40.,200,-40.,40.);
    hName = "DCC_PhibResidualvsTkPos";
    chambMap[hName] =dbe->book2D(hName+chTag,"Local direction residual vs Segment Position",100,-500.,500.,200,-10.,10.);
    hName = "DCC_PhiResidualvsTkPos";
    chambMap[hName] =dbe->book2D(hName+chTag,"Local Position residual vs Segment Position",100,-500.,500.,200,-10.,10.);

  }

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

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 158 of file DTLocalTriggerLutTask.cc.

References dbe, nEvents, DQMStore::rmdir(), and topFolder().

                                  {
        
  LogVerbatim("DTDQM|DTMonitorModule|DTLocalTriggerLutTask") << "[DTLocalTriggerLutTask]: analyzed " << nEvents << " events" << endl;
  dbe->rmdir(topFolder());
        
}
void DTLocalTriggerLutTask::searchDccBest ( std::vector< L1MuDTChambPhDigi > *  trigs) [protected]

Find best (highest qual) DCC trigger segments.

Definition at line 255 of file DTLocalTriggerLutTask.cc.

References trigBest, and trigQualBest.

Referenced by analyze().

                                                                              {
  
  string histoType ;
  string histoTag ;
  
  // define best quality trigger segment
  // start from 1 and zero is kept empty
  for (int st=0;st<=4;++st)
    for (int wh=0;wh<=5;++wh)
      for (int sec=0;sec<=12;++sec)
        trigQualBest[wh][st][sec] = -1;    
        
  vector<L1MuDTChambPhDigi>::const_iterator trigIt  = trigs->begin();
  vector<L1MuDTChambPhDigi>::const_iterator trigEnd = trigs->end();
  for(; trigIt!=trigEnd; ++trigIt) {
    
    int wh   = trigIt->whNum();
    int sec  = trigIt->scNum() + 1; // DTTF -> DT sector range transform
    int st   = trigIt->stNum();
    int qual = trigIt->code();

    if(qual>trigQualBest[wh+3][st][sec] && qual<7) {
      trigQualBest[wh+3][st][sec]=qual; 
      trigBest[wh+3][st][sec] = &(*trigIt);
    }
    
  }
}
std::string& DTLocalTriggerLutTask::topFolder ( ) [inline, private]

Get the top folder.

Definition at line 76 of file DTLocalTriggerLutTask.h.

References baseFolder.

Referenced by bookHistos(), and endJob().

{ return  baseFolder; }

Friends And Related Function Documentation

friend class DTMonitorModule [friend]

Definition at line 43 of file DTLocalTriggerLutTask.h.


Member Data Documentation

std::string DTLocalTriggerLutTask::baseFolder [private]

Definition at line 88 of file DTLocalTriggerLutTask.h.

Referenced by DTLocalTriggerLutTask(), and topFolder().

std::map<uint32_t, std::map<std::string, MonitorElement*> > DTLocalTriggerLutTask::chHistos [private]

Definition at line 105 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), beginLuminosityBlock(), and bookHistos().

Definition at line 99 of file DTLocalTriggerLutTask.h.

Referenced by bookHistos(), DTLocalTriggerLutTask(), and endJob().

Definition at line 92 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), and DTLocalTriggerLutTask().

Definition at line 89 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), bookHistos(), and DTLocalTriggerLutTask().

Definition at line 101 of file DTLocalTriggerLutTask.h.

Referenced by beginRun().

Definition at line 83 of file DTLocalTriggerLutTask.h.

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

Definition at line 84 of file DTLocalTriggerLutTask.h.

Referenced by beginJob(), and beginLuminosityBlock().

Definition at line 85 of file DTLocalTriggerLutTask.h.

Referenced by bookHistos(), and DTLocalTriggerLutTask().

Definition at line 85 of file DTLocalTriggerLutTask.h.

Referenced by bookHistos(), and DTLocalTriggerLutTask().

Definition at line 90 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), and DTLocalTriggerLutTask().

Definition at line 100 of file DTLocalTriggerLutTask.h.

Referenced by beginLuminosityBlock(), and DTLocalTriggerLutTask().

Definition at line 86 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), bookHistos(), and DTLocalTriggerLutTask().

Definition at line 86 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), bookHistos(), and DTLocalTriggerLutTask().

Definition at line 93 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), and DTLocalTriggerLutTask().

std::string DTLocalTriggerLutTask::theGeomLabel [private]

Definition at line 102 of file DTLocalTriggerLutTask.h.

Referenced by beginRun(), and DTLocalTriggerLutTask().

bool DTLocalTriggerLutTask::track_ok[6][5][15] [private]

Definition at line 97 of file DTLocalTriggerLutTask.h.

Definition at line 96 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), and searchDccBest().

Definition at line 103 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), beginRun(), and ~DTLocalTriggerLutTask().

int DTLocalTriggerLutTask::trigQualBest[6][5][13] [private]

Definition at line 95 of file DTLocalTriggerLutTask.h.

Referenced by analyze(), and searchDccBest().

std::map<int, std::map<std::string, MonitorElement*> > DTLocalTriggerLutTask::whHistos [private]

Definition at line 106 of file DTLocalTriggerLutTask.h.