CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTRunConditionVar Class Reference

#include <DTRunConditionVar.h>

Inheritance diagram for DTRunConditionVar:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
void beginJob ()
void beginRun (const edm::Run &, const edm::EventSetup &)
 DTRunConditionVar (const edm::ParameterSet &pset)
void endJob ()
 ~DTRunConditionVar ()

Private Member Functions

void bookChamberHistos (const DTChamberId &dtCh, std::string histoType, int, float, float)

Private Attributes

std::map< uint32_t, std::map
< std::string, MonitorElement * > > 
chamberHistos
bool debug
edm::ESHandle< DTGeometrydtGeom
double maxAnglePhiSegm
edm::ESHandle< DTMtimemTime
const DTMtimemTimeMap_
int nMinHitsPhi
DQMStoretheDbe
edm::InputTag thedt4DSegments_

Detailed Description

Description:

Author:
: Paolo Bellan, Antonio Branca $date : 23/09/2011 15:42:04 CET $
Revision:
1.2

Modification:

Definition at line 43 of file DTRunConditionVar.h.


Constructor & Destructor Documentation

DTRunConditionVar::DTRunConditionVar ( const edm::ParameterSet pset)

Definition at line 47 of file DTRunConditionVar.cc.

References cppFunctionSkipper::operator, and theDbe.

                                                            :
  // Get the debug parameter for verbose output
  debug(pSet.getUntrackedParameter<bool>("debug",false)),
  nMinHitsPhi(pSet.getUntrackedParameter<int>("nMinHitsPhi")),
  maxAnglePhiSegm(pSet.getUntrackedParameter<double>("maxAnglePhiSegm")),
  thedt4DSegments_(pSet.getParameter<InputTag>("recoSegments"))
{
  //  LogVerbatim("DTDQM|DTRunConditionVar|DTRunConditionVar")
  //    << "DTRunConditionVar: constructor called";

  // Get the DQM needed services
  theDbe = Service<DQMStore>().operator->();

}
DTRunConditionVar::~DTRunConditionVar ( )

Definition at line 62 of file DTRunConditionVar.cc.

References LogTrace.

{
  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
    << "DTRunConditionVar: destructor called";

  // free memory
}

Member Function Documentation

void DTRunConditionVar::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 117 of file DTRunConditionVar.cc.

References chamberHistos, DTVelocityUnits::cm_per_ns, DTChamberId, dtGeom, Exception, HcalObjRepresent::Fill(), edm::EventSetup::get(), DTMtime::get(), LogTrace, maxAnglePhiSegm, mTime, mTimeMap_, nMinHitsPhi, Pi, DetId::rawId(), thedt4DSegments_, and xdir.

{

  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar") <<
    "--- [DTRunConditionVar] Event analysed #Run: " <<
    event.id().run() << " #Event: " << event.id().event() << endl;

  // Get the DT Geometry
  ESHandle<DTGeometry> dtGeom;
  eventSetup.get<MuonGeometryRecord>().get(dtGeom);

  // Get the map of vdrift from the setup
  eventSetup.get<DTMtimeRcd>().get(mTime);
  mTimeMap_ = &*mTime;

  // Get the segment collection from the event
  Handle<DTRecSegment4DCollection> all4DSegments;
  event.getByLabel(thedt4DSegments_, all4DSegments); 

  // Loop over the segments
  for(DTRecSegment4DCollection::const_iterator segment  = all4DSegments->begin();
      segment != all4DSegments->end(); ++segment){

    // Get the chamber from the setup
    DTChamberId DTid = (DTChamberId) segment->chamberId();
    uint32_t indexCh = DTid.rawId();

    // Fill v-drift values
    if( (*segment).hasPhi() ) {

      int nHitsPhi = (*segment).phiSegment()->degreesOfFreedom()+2;
      double xdir = (*segment).phiSegment()->localDirection().x();      
      double zdir = (*segment).phiSegment()->localDirection().z();      

      double anglePhiSegm = fabs(atan(xdir/zdir))*180./TMath::Pi();

      if( nHitsPhi >= nMinHitsPhi && anglePhiSegm <= maxAnglePhiSegm ) {

        double segmentVDrift = segment->phiSegment()->vDrift();


        DTSuperLayerId indexSLPhi1(DTid,1);
        DTSuperLayerId indexSLPhi2(DTid,3);

        float vDriftPhi1(0.), vDriftPhi2(0.); 
        float ResPhi1(0.), ResPhi2(0.);
        int status1 = mTimeMap_->get(indexSLPhi1,vDriftPhi1,ResPhi1,DTVelocityUnits::cm_per_ns); 
        int status2 = mTimeMap_->get(indexSLPhi2,vDriftPhi2,ResPhi2,DTVelocityUnits::cm_per_ns); 

        if(status1 != 0 || status2 != 0) {
          DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; 
          throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for"
            << sl << endl;
        }

        float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.;

        segmentVDrift = vDriftMed*(1. - segmentVDrift);

        double segmentT0 = segment->phiSegment()->t0();

        if( segment->phiSegment()->ist0Valid() ) (chamberHistos[indexCh])["T0_FromSegm"]->Fill(segmentT0);
        if( segmentVDrift != vDriftMed ) (chamberHistos[indexCh])["VDrift_FromSegm"]->Fill(segmentVDrift);

      }
    }

    //    if( (*segment).hasZed() ){
    //      double segmentVDrift = segment->zSegment()->vDrift();
    //      double segmentT0 = segment->zSegment()->t0();
    //
    //
    //      if(segmentT0 != -999 ) ht0[sector-1]->Fill(segmentT0);      
    //      if( segmentVDrift > 0.00 ) hvd[sector-1]->Fill(segmentVDrift);
    //
    //    }
  } //end loop on segment

} //end analyze
void DTRunConditionVar::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file DTRunConditionVar.cc.

References bookChamberHistos(), DTChamberId, LogTrace, and testRegression::stat.

                                 {

  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
    << "DTRunConditionVar: beginOfJob";

  for(int wheel=-2;wheel<=2;wheel++){
    for(int sec=1; sec<=14; sec++) {
      for(int stat=1; stat<=4; stat++) {

        bookChamberHistos(DTChamberId(wheel,stat,sec),"VDrift_FromSegm",100,0.0043,0.0065);
        bookChamberHistos(DTChamberId(wheel,stat,sec),"T0_FromSegm",100,-25.,25.);

      }
    }
  }


  return;
}
void DTRunConditionVar::beginRun ( const edm::Run run,
const edm::EventSetup setup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 96 of file DTRunConditionVar.cc.

References dtGeom, and edm::EventSetup::get().

{
  // Get the DT Geometry
  setup.get<MuonGeometryRecord>().get(dtGeom);

  return;
}
void DTRunConditionVar::bookChamberHistos ( const DTChamberId dtCh,
std::string  histoType,
int  ,
float  ,
float   
) [private]

Referenced by beginJob().

void DTRunConditionVar::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file DTRunConditionVar.cc.

References LogTrace.

{
  LogTrace("DTDQM|DTMonitorModule|DTRunConditionVar")
    << "DTRunConditionVar: endOfJob";

  return;
}

Member Data Documentation

std::map<uint32_t, std::map<std::string, MonitorElement*> > DTRunConditionVar::chamberHistos [private]

Definition at line 76 of file DTRunConditionVar.h.

Referenced by analyze(), and DTTriggerEfficiencyTask::bookChamberHistos().

bool DTRunConditionVar::debug [private]

Definition at line 63 of file DTRunConditionVar.h.

Definition at line 69 of file DTRunConditionVar.h.

Referenced by analyze(), and beginRun().

Definition at line 65 of file DTRunConditionVar.h.

Referenced by analyze().

Definition at line 71 of file DTRunConditionVar.h.

Referenced by analyze().

Definition at line 72 of file DTRunConditionVar.h.

Referenced by analyze().

Definition at line 64 of file DTRunConditionVar.h.

Referenced by analyze().

Definition at line 67 of file DTRunConditionVar.h.

Referenced by analyze().