CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DTRecHitQuality Class Reference

#include <DTRecHitQuality.h>

Inheritance diagram for DTRecHitQuality:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup)
 Perform the real analysis.
 DTRecHitQuality (const edm::ParameterSet &pset)
 Constructor.
void endJob ()
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
template<typename type >
const typefindBestRecHit (const DTLayer *layer, DTWireId wireId, const vector< type > &recHits, const float simHitDist)
virtual ~DTRecHitQuality ()
 Destructor.

Private Member Functions

template<typename type >
void compute (const DTGeometry *dtGeom, std::map< DTWireId, std::vector< PSimHit > > simHitsPerWire, std::map< DTWireId, std::vector< type > > recHitsPerWire, int step)
template<typename type >
const typefindBestRecHit (const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
std::map< DTWireId,
std::vector< DTRecHit1D > > 
map1DRecHitsPerWire (const DTRecSegment2DCollection *segment2Ds)
std::map< DTWireId,
std::vector< DTRecHit1DPair > > 
map1DRecHitsPerWire (const DTRecHitCollection *dt1DRecHitPairs)
std::map< DTWireId,
std::vector< DTRecHit1D > > 
map1DRecHitsPerWire (const DTRecSegment4DCollection *segment4Ds)
float recHitDistFromWire (const DTRecHit1DPair &hitPair, const DTLayer *layer)
float recHitDistFromWire (const DTRecHit1D &recHit, const DTLayer *layer)
float recHitPositionError (const DTRecHit1DPair &recHit)
float recHitPositionError (const DTRecHit1D &recHit)
float simHitDistFromFE (const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
float simHitDistFromWire (const DTLayer *layer, DTWireId wireId, const PSimHit &hit)
float simHitImpactAngle (const DTLayer *layer, DTWireId wireId, const PSimHit &hit)

Private Attributes

DQMStoredbe_
bool debug
bool doall
bool doStep1
bool doStep2
bool doStep3
HEff1DHithEff_S1RPhi
HEff1DHithEff_S1RZ
HEff1DHithEff_S1RZ_W0
HEff1DHithEff_S1RZ_W1
HEff1DHithEff_S1RZ_W2
HEff1DHithEff_S2RPhi
HEff1DHithEff_S2RZ
HEff1DHithEff_S2RZ_W0
HEff1DHithEff_S2RZ_W1
HEff1DHithEff_S2RZ_W2
HEff1DHithEff_S3RPhi
HEff1DHithEff_S3RZ
HEff1DHithEff_S3RZ_W0
HEff1DHithEff_S3RZ_W1
HEff1DHithEff_S3RZ_W2
HRes1DHithRes_S1RPhi
HRes1DHithRes_S1RPhi_W0
HRes1DHithRes_S1RPhi_W1
HRes1DHithRes_S1RPhi_W2
HRes1DHithRes_S1RZ
HRes1DHithRes_S1RZ_W0
HRes1DHithRes_S1RZ_W1
HRes1DHithRes_S1RZ_W2
HRes1DHithRes_S2RPhi
HRes1DHithRes_S2RPhi_W0
HRes1DHithRes_S2RPhi_W1
HRes1DHithRes_S2RPhi_W2
HRes1DHithRes_S2RZ
HRes1DHithRes_S2RZ_W0
HRes1DHithRes_S2RZ_W1
HRes1DHithRes_S2RZ_W2
HRes1DHithRes_S3RPhi
HRes1DHithRes_S3RPhi_W0
HRes1DHithRes_S3RPhi_W1
HRes1DHithRes_S3RPhi_W2
HRes1DHithRes_S3RZ
HRes1DHithRes_S3RZ_W0
HRes1DHithRes_S3RZ_W1
HRes1DHithRes_S3RZ_W2
bool local
edm::InputTag recHitLabel
std::string rootFileName
edm::InputTag segment2DLabel
edm::InputTag segment4DLabel
edm::InputTag simHitLabel

Detailed Description

Basic analyzer class which accesses 1D DTRecHits and plot resolution comparing reconstructed and simulated quantities

Date:
2010/09/17 07:48:11
Revision:
1.10
Author:
G. Cerminara - INFN Torino

Definition at line 44 of file DTRecHitQuality.h.


Constructor & Destructor Documentation

DTRecHitQuality::DTRecHitQuality ( const edm::ParameterSet pset)

Constructor.

Definition at line 39 of file DTRecHitQuality.cc.

References dbe_, debug, edm::ParameterSet::getUntrackedParameter(), and cmsCodeRules::cppFunctionSkipper::operator.

                                                        {
  // Get the debug parameter for verbose output
  debug = pset.getUntrackedParameter<bool>("debug");
  // the name of the simhit collection
  simHitLabel = pset.getUntrackedParameter<InputTag>("simHitLabel");
  // the name of the 1D rec hit collection
  recHitLabel = pset.getUntrackedParameter<InputTag>("recHitLabel");
  // the name of the 2D rec hit collection
  segment2DLabel = pset.getUntrackedParameter<InputTag>("segment2DLabel");
  // the name of the 4D rec hit collection
  segment4DLabel = pset.getUntrackedParameter<InputTag>("segment4DLabel");

  // Switches for analysis at various steps
  doStep1 = pset.getUntrackedParameter<bool>("doStep1", false);
  doStep2 = pset.getUntrackedParameter<bool>("doStep2", false);
  doStep3 = pset.getUntrackedParameter<bool>("doStep3", false);
  doall = pset.getUntrackedParameter<bool>("doall", false);
  local = pset.getUntrackedParameter<bool>("local", true);
  // if(doall) doStep1
  // Create the root file
  //theFile = new TFile(rootFileName.c_str(), "RECREATE");
  //theFile->cd();


  // ----------------------                 
  // get hold of back-end interface 
  dbe_ = 0;
  dbe_ = Service<DQMStore>().operator->();
  /*if ( dbe_ ) {
    if (debug) {
      dbe_->setVerbose(1);
    } else {
      dbe_->setVerbose(0);
    }
    }*/
  dbe_->setVerbose(0);
  /*if ( dbe_ ) {
    if ( debug ) dbe_->showDirStructure();
    }*/
  if(doall && doStep1){
    hRes_S1RPhi= new HRes1DHit("S1RPhi",dbe_,true,local);    // RecHits, 1. step, RPhi
    hRes_S1RPhi_W0= new HRes1DHit("S1RPhi_W0",dbe_,true,local);   // RecHits, 1. step, RZ, wheel 0
    hRes_S1RPhi_W1= new HRes1DHit("S1RPhi_W1",dbe_,true,local);   // RecHits, 1. step, RZ, wheel +-1
    hRes_S1RPhi_W2= new HRes1DHit("S1RPhi_W2",dbe_,true,local);   // RecHits, 1. step, RZ, wheel +-2
    hRes_S1RZ= new HRes1DHit("S1RZ",dbe_,true,local);         // RecHits, 1. step, RZ
    hRes_S1RZ_W0= new HRes1DHit("S1RZ_W0",dbe_,true,local);   // RecHits, 1. step, RZ, wheel 0
    hRes_S1RZ_W1= new HRes1DHit("S1RZ_W1",dbe_,true,local);   // RecHits, 1. step, RZ, wheel +-1
    hRes_S1RZ_W2= new HRes1DHit("S1RZ_W2",dbe_,true,local);   // RecHits, 1. step, RZ, wheel +-2
    hEff_S1RPhi= new HEff1DHit("S1RPhi",dbe_);     // RecHits, 1. step, RPhi
    hEff_S1RZ= new HEff1DHit("S1RZ",dbe_);         // RecHits, 1. step, RZ
    hEff_S1RZ_W0= new HEff1DHit("S1RZ_W0",dbe_);   // RecHits, 1. step, RZ, wheel 0
    hEff_S1RZ_W1= new HEff1DHit("S1RZ_W1",dbe_);   // RecHits, 1. step, RZ, wheel +-1
    hEff_S1RZ_W2= new HEff1DHit("S1RZ_W2",dbe_);   // RecHits, 1. step, RZ, wheel +-2
  }
  if(doall && doStep2){
    hRes_S2RPhi= new HRes1DHit("S2RPhi",dbe_,true,local);     // RecHits, 2. step, RPhi
    hRes_S2RPhi_W0= new HRes1DHit("S2RPhi_W0",dbe_,true,local);   // RecHits, 2. step, RPhi, wheel 0
    hRes_S2RPhi_W1= new HRes1DHit("S2RPhi_W1",dbe_,true,local);   // RecHits, 2. step, RPhi, wheel +-1
    hRes_S2RPhi_W2= new HRes1DHit("S2RPhi_W2",dbe_,true,local);   // RecHits, 2. step, RPhi, wheel +-2
    hRes_S2RZ= new HRes1DHit("S2RZ",dbe_,true,local);       // RecHits, 2. step, RZ
    hRes_S2RZ_W0= new HRes1DHit("S2RZ_W0",dbe_,true,local);   // RecHits, 2. step, RZ, wheel 0
    hRes_S2RZ_W1= new HRes1DHit("S2RZ_W1",dbe_,true,local);   // RecHits, 2. step, RZ, wheel +-1
    hRes_S2RZ_W2= new HRes1DHit("S2RZ_W2",dbe_,true,local);   // RecHits, 2. step, RZ, wheel +-2
    hEff_S2RPhi= new HEff1DHit("S2RPhi",dbe_);     // RecHits, 2. step, RPhi
    hEff_S2RZ_W0= new HEff1DHit("S2RZ_W0",dbe_);   // RecHits, 2. step, RZ, wheel 0
    hEff_S2RZ_W1= new HEff1DHit("S2RZ_W1",dbe_);   // RecHits, 2. step, RZ, wheel +-1
    hEff_S2RZ_W2= new HEff1DHit("S2RZ_W2",dbe_);   // RecHits, 2. step, RZ, wheel +-2
    hEff_S2RZ= new HEff1DHit("S2RZ",dbe_);          // RecHits, 2. step, RZ
  }
  if(doStep3){
    hRes_S3RPhi= new HRes1DHit("S3RPhi",dbe_,doall,local);     // RecHits, 3. step, RPhi
    hRes_S3RPhi_W0= new HRes1DHit("S3RPhi_W0",dbe_,doall,local);   // RecHits, 3. step, RPhi, wheel 0
    hRes_S3RPhi_W1= new HRes1DHit("S3RPhi_W1",dbe_,doall,local);   // RecHits, 3. step, RPhi, wheel +-1
    hRes_S3RPhi_W2= new HRes1DHit("S3RPhi_W2",dbe_,doall,local);   // RecHits, 3. step, RPhi, wheel +-2
    hRes_S3RZ= new HRes1DHit("S3RZ",dbe_,doall,local);      // RecHits, 3. step, RZ
    hRes_S3RZ_W0= new HRes1DHit("S3RZ_W0",dbe_,doall,local);   // RecHits, 3. step, RZ, wheel 0
    hRes_S3RZ_W1= new HRes1DHit("S3RZ_W1",dbe_,doall,local);   // RecHits, 3. step, RZ, wheel +-1
    hRes_S3RZ_W2= new HRes1DHit("S3RZ_W2",dbe_,doall,local);   // RecHits, 3. step, RZ, wheel +-2
    if(doall){
      hEff_S3RPhi= new HEff1DHit("S3RPhi",dbe_);     // RecHits, 3. step, RPhi
      hEff_S3RZ= new HEff1DHit("S3RZ",dbe_);        // RecHits, 3. step, RZ
      hEff_S3RZ_W0= new HEff1DHit("S3RZ_W0",dbe_);   // RecHits, 3. step, RZ, wheel 0
      hEff_S3RZ_W1= new HEff1DHit("S3RZ_W1",dbe_);   // RecHits, 3. step, RZ, wheel +-1
      hEff_S3RZ_W2= new HEff1DHit("S3RZ_W2",dbe_);   // RecHits, 3. step, RZ, wheel +-2
    }
  }
}
DTRecHitQuality::~DTRecHitQuality ( ) [virtual]

Destructor.

Definition at line 129 of file DTRecHitQuality.cc.

                                 {
}

Member Function Documentation

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

Perform the real analysis.

Implements edm::EDAnalyzer.

Definition at line 211 of file DTRecHitQuality.cc.

References bookConverter::compute(), gather_cfg::cout, debug, edm::EventSetup::get(), edm::HandleBase::isValid(), DTHitQualityUtils::mapSimHitsPerWire(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), and trackerHits::simHits.

                                                                                {
    if(debug)
      cout << "--- [DTRecHitQuality] Analysing Event: #Run: " << event.id().run()
        << " #Event: " << event.id().event() << endl;
    //theFile->cd();
    // Get the DT Geometry
    ESHandle<DTGeometry> dtGeom;
    eventSetup.get<MuonGeometryRecord>().get(dtGeom);

    // Get the SimHit collection from the event
    Handle<PSimHitContainer> simHits;
    event.getByLabel(simHitLabel, simHits);

    // Map simhits per wire
    map<DTWireId, PSimHitContainer > simHitsPerWire =
      DTHitQualityUtils::mapSimHitsPerWire(*(simHits.product()));



     //=======================================================================================
    // RecHit analysis at Step 1
    if(doStep1 && doall) {
      if(debug)
        cout << "  -- DTRecHit S1: begin analysis:" << endl;
      // Get the rechit collection from the event
      Handle<DTRecHitCollection> dtRecHits;
      event.getByLabel(recHitLabel, dtRecHits);

      if(!dtRecHits.isValid()) {
        if(debug) cout << "[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel << " in this event, skipping!" << endl;
        return;
      }
     
     // Map rechits per wire
      map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire = 
        map1DRecHitsPerWire(dtRecHits.product());

      compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
    }


    //=======================================================================================
    // RecHit analysis at Step 2
    if(doStep2 && doall) {
      if(debug)
        cout << "  -- DTRecHit S2: begin analysis:" << endl;

      // Get the 2D rechits from the event
      Handle<DTRecSegment2DCollection> segment2Ds;
      event.getByLabel(segment2DLabel, segment2Ds);

      if(!segment2Ds.isValid()) {
       if(debug) cout << "[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel
                      << " in this event, skipping!" << endl;
       
      }
      else{
        // Map rechits per wire
        map<DTWireId,vector<DTRecHit1D> > recHitsPerWire = 
          map1DRecHitsPerWire(segment2Ds.product());
        
        compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 2);
      }
    }

    //=======================================================================================
    // RecHit analysis at Step 3
    if(doStep3) {
      if(debug)
        cout << "  -- DTRecHit S3: begin analysis:" << endl;

      // Get the 4D rechits from the event
      Handle<DTRecSegment4DCollection> segment4Ds;
      event.getByLabel(segment4DLabel, segment4Ds);

      if(!segment4Ds.isValid()) {
        if(debug) cout << "[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel
                       << " in this event, skipping!" << endl;
        return;
      }

      // Map rechits per wire
      map<DTWireId,vector<DTRecHit1D> > recHitsPerWire = 
        map1DRecHitsPerWire(segment4Ds.product());

      compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 3);
    }

  }
template<typename type >
void DTRecHitQuality::compute ( const DTGeometry dtGeom,
std::map< DTWireId, std::vector< PSimHit > >  simHitsPerWire,
std::map< DTWireId, std::vector< type > >  recHitsPerWire,
int  step 
) [private]

Definition at line 443 of file DTRecHitQuality.cc.

References abs, gather_cfg::cout, debug, PV3DBase< T, PVType, FrameType >::eta(), HRes1DHit::Fill(), HEff1DHit::Fill(), DTHitQualityUtils::findMuSimHit(), DTGeometry::layer(), PSimHit::localPosition(), PV3DBase< T, PVType, FrameType >::phi(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTSuperLayerId::superlayer(), GeomDet::toGlobal(), and DTChamberId::wheel().

                                        {
  // Loop over cells with a muon SimHit
  for(map<DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
      wireAndSHits != simHitsPerWire.end();
      wireAndSHits++) {
    DTWireId wireId = (*wireAndSHits).first;
    vector<PSimHit> simHitsInCell = (*wireAndSHits).second;

    // Get the layer
    const DTLayer* layer = dtGeom->layer(wireId);

    // Look for a mu hit in the cell
    const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
    if (muSimHit==0) {
      if (debug) 
        cout << "   No mu SimHit in channel: " << wireId << ", skipping! " << endl;
      continue; // Skip this cell
    }

    // Find the distance of the simhit from the wire
    float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
    // Skip simhits out of the cell
    if(simHitWireDist>2.1) {
      if(debug) 
        cout << "  [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
      continue; // Skip this cell
    }
    GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());

    // find SH impact angle
    float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);

    // find SH distance from FE
    float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);

    bool recHitReconstructed = false;

    // Look for RecHits in the same cell
    if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
      // No RecHit found in this cell
      if(debug)
        cout << "   No RecHit found at Step: " << step << " in cell: " << wireId << endl;
    } else {
      recHitReconstructed = true;
      // vector<type> recHits = (*wireAndRecHits).second;
      vector<type> recHits = recHitsPerWire[wireId];
      if(debug)
        cout << "   " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId << endl;

      // Find the best RecHit
      const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);


      float recHitWireDist =  recHitDistFromWire(*theBestRecHit, layer);
      if(debug)
        cout << "    SimHit distance from wire: " << simHitWireDist << endl
          << "    SimHit distance from FE: " << simHitFEDist << endl
          << "    SimHit distance angle " << simHitTheta << endl
          << "    RecHit distance from wire: " << recHitWireDist << endl;
      float recHitErr = recHitPositionError(*theBestRecHit);
      HRes1DHit *hRes = 0;
      HRes1DHit *hResTot = 0;

      // Fill residuals and pulls
      // Select the histo to be filled
      if(step == 1) {
        // Step 1
        if(wireId.superLayer() != 2) {
          hResTot = hRes_S1RPhi;
          if(wireId.wheel() == 0)
            hRes = hRes_S1RPhi_W0;
          if(abs(wireId.wheel()) == 1)
            hRes = hRes_S1RPhi_W1;
          if(abs(wireId.wheel()) == 2)
            hRes = hRes_S1RPhi_W2;
        } else {
          hResTot = hRes_S1RZ;
          if(wireId.wheel() == 0)
            hRes = hRes_S1RZ_W0;
          if(abs(wireId.wheel()) == 1)
            hRes = hRes_S1RZ_W1;
          if(abs(wireId.wheel()) == 2)
            hRes = hRes_S1RZ_W2;
        }

      } else if(step == 2) {
        // Step 2
        if(wireId.superlayer() != 2) {
          hRes = hRes_S2RPhi;
          if(wireId.wheel() == 0)
            hRes = hRes_S2RPhi_W0;
          if(abs(wireId.wheel()) == 1)
            hRes = hRes_S2RPhi_W1;
          if(abs(wireId.wheel()) == 2)
            hRes = hRes_S2RPhi_W2;
        } else {
          hResTot = hRes_S2RZ;
          if(wireId.wheel() == 0)
            hRes = hRes_S2RZ_W0;
          if(abs(wireId.wheel()) == 1)
            hRes = hRes_S2RZ_W1;
          if(abs(wireId.wheel()) == 2)
            hRes = hRes_S2RZ_W2;
        }

      } else if(step == 3) {
        // Step 3
        if(wireId.superlayer() != 2) {
          hResTot = hRes_S3RPhi;
          if(wireId.wheel() == 0)
            hRes = hRes_S3RPhi_W0;
          if(abs(wireId.wheel()) == 1)
            hRes = hRes_S3RPhi_W1;
          if(abs(wireId.wheel()) == 2)
            hRes = hRes_S3RPhi_W2;
        } else {
          hResTot = hRes_S3RZ;
          if(wireId.wheel() == 0)
            hRes = hRes_S3RZ_W0;
          if(abs(wireId.wheel()) == 1)
            hRes = hRes_S3RZ_W1;
          if(abs(wireId.wheel()) == 2)
            hRes = hRes_S3RZ_W2;
        }

      }
      // Fill
      hRes->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
                 simHitGlobalPos.phi(),recHitErr,wireId.station());
      if(hResTot != 0)
        hResTot->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
                      simHitGlobalPos.phi(),recHitErr,wireId.station());
    }

    // Fill Efficiencies
    if(doall){
      HEff1DHit *hEff = 0;
      HEff1DHit *hEffTot = 0;
      if(step == 1) {
        // Step 1
        if(wireId.superlayer() != 2) {
          hEff = hEff_S1RPhi;
        } else {
          hEffTot = hEff_S1RZ;
          if(wireId.wheel() == 0)
            hEff = hEff_S1RZ_W0;
          if(abs(wireId.wheel()) == 1)
            hEff = hEff_S1RZ_W1;
          if(abs(wireId.wheel()) == 2)
            hEff = hEff_S1RZ_W2;
        }
        
      } else if(step == 2) {
        // Step 2
        if(wireId.superlayer() != 2) {
          hEff = hEff_S2RPhi;
        } else {
          hEffTot = hEff_S2RZ;
          if(wireId.wheel() == 0)
            hEff = hEff_S2RZ_W0;
          if(abs(wireId.wheel()) == 1)
            hEff = hEff_S2RZ_W1;
          if(abs(wireId.wheel()) == 2)
            hEff = hEff_S2RZ_W2;
        }
        
      } else if(step == 3) {
        // Step 3
        if(wireId.superlayer() != 2) {
          hEff = hEff_S3RPhi;
        } else {
          hEffTot = hEff_S3RZ;
          if(wireId.wheel() == 0)
            hEff = hEff_S3RZ_W0;
          if(abs(wireId.wheel()) == 1)
            hEff = hEff_S3RZ_W1;
          if(abs(wireId.wheel()) == 2)
            hEff = hEff_S3RZ_W2;
        }
        
      }
      // Fill
      hEff->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
      if(hEffTot != 0)
        hEffTot->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
    }
  }
}
void DTRecHitQuality::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 138 of file DTRecHitQuality.cc.

                             {
  // Write the histos to file
  if(doall){
    if(doStep1){
      hEff_S1RPhi->ComputeEfficiency();
      hEff_S1RZ->ComputeEfficiency();
      hEff_S1RZ_W0->ComputeEfficiency();
      hEff_S1RZ_W1->ComputeEfficiency();
      hEff_S1RZ_W2->ComputeEfficiency();
    }
    if(doStep2){
      hEff_S2RPhi->ComputeEfficiency();
      hEff_S2RZ->ComputeEfficiency();
      hEff_S2RZ_W0->ComputeEfficiency();
      hEff_S2RZ_W1->ComputeEfficiency();
      hEff_S2RZ_W2->ComputeEfficiency();
    }
    if(doStep3){
      hEff_S3RPhi->ComputeEfficiency();
      hEff_S3RZ->ComputeEfficiency();
      hEff_S3RZ_W0->ComputeEfficiency();
      hEff_S3RZ_W1->ComputeEfficiency();
      hEff_S3RZ_W2->ComputeEfficiency();
    }
  }
  //if ( rootFileName.size() != 0 && dbe_ ) dbe_->save(rootFileName); 

  // Write histos to file
  /*hRes_S1RPhi->Write();
  hRes_S2RPhi->Write();
  hRes_S3RPhi->Write();

  hRes_S1RZ->Write();
  hRes_S2RZ->Write();
  hRes_S3RZ->Write();

  hRes_S1RZ_W0->Write();
  hRes_S2RZ_W0->Write();
  hRes_S3RZ_W0->Write();

  hRes_S1RZ_W1->Write();
  hRes_S2RZ_W1->Write();
  hRes_S3RZ_W1->Write();

  hRes_S1RZ_W2->Write();
  hRes_S2RZ_W2->Write();
  hRes_S3RZ_W2->Write();


  hEff_S1RPhi->Write();
  hEff_S2RPhi->Write();
  hEff_S3RPhi->Write();

  hEff_S1RZ->Write();
  hEff_S2RZ->Write();
  hEff_S3RZ->Write();

  hEff_S1RZ_W0->Write();
  hEff_S2RZ_W0->Write();
  hEff_S3RZ_W0->Write();

  hEff_S1RZ_W1->Write();
  hEff_S2RZ_W1->Write();
  hEff_S3RZ_W1->Write();

  hEff_S1RZ_W2->Write();
  hEff_S2RZ_W2->Write();
  hEff_S3RZ_W2->Write();*/

  //theFile->Close();
}
void DTRecHitQuality::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 133 of file DTRecHitQuality.cc.

                           {

}
template<typename type >
const type* DTRecHitQuality::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const vector< type > &  recHits,
const float  simHitDist 
)

Definition at line 404 of file DTRecHitQuality.cc.

                                                        {
  float res = 99999;
  const type* theBestRecHit = 0;
  // Loop over RecHits within the cell
  for(typename vector<type>::const_iterator recHit = recHits.begin();
      recHit != recHits.end();
      recHit++) {
    float distTmp = recHitDistFromWire(*recHit, layer);
    if(fabs(distTmp-simHitDist) < res) {
      res = fabs(distTmp-simHitDist);
      theBestRecHit = &(*recHit);
    }
  } // End of loop over RecHits within the cell

  return theBestRecHit;
}
template<typename type >
const type* DTRecHitQuality::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const std::vector< type > &  recHits,
const float  simHitDist 
) [private]
map< DTWireId, vector< DTRecHit1DPair > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecHitCollection dt1DRecHitPairs) [private]

Definition at line 305 of file DTRecHitQuality.cc.

References runTheMatrix::ret.

                                                                              {
  map<DTWireId, vector<DTRecHit1DPair> > ret;

  for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
      rechit != dt1DRecHitPairs->end(); rechit++) {
    ret[(*rechit).wireId()].push_back(*rechit);
  }

  return ret;
}
map< DTWireId, vector< DTRecHit1D > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecSegment2DCollection segment2Ds) [private]

Definition at line 319 of file DTRecHitQuality.cc.

References runTheMatrix::ret.

                                                                               {
  map<DTWireId, vector<DTRecHit1D> > ret;

  // Loop over all 2D segments
  for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
      segment != segment2Ds->end();
      segment++) {
    vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
    // Loop over all component 1D hits
    for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
        hit != component1DHits.end();
        hit++) {
      ret[(*hit).wireId()].push_back(*hit);
    }
  }
  return ret;
}
map< DTWireId, std::vector< DTRecHit1D > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds) [private]

Definition at line 341 of file DTRecHitQuality.cc.

References runTheMatrix::ret, and DTRecHit1D::wireId().

                                                                               {
  map<DTWireId, vector<DTRecHit1D> > ret;
  // Loop over all 4D segments
  for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
      segment != segment4Ds->end();
      segment++) {
    // Get component 2D segments
    vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
    // Loop over 2D segments:
    for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
        segment2D != segment2Ds.end();
        segment2D++) {
      // Get 1D component rechits
      vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
      // Loop over them
      for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
          hit != hits.end(); hit++) {
        const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
        ret[hit1D->wireId()].push_back(*hit1D);
      }
    }
  }

  return ret;
}
float DTRecHitQuality::recHitDistFromWire ( const DTRecHit1DPair hitPair,
const DTLayer layer 
) [private]

Definition at line 427 of file DTRecHitQuality.cc.

References DTEnums::Left, DTRecHit1DPair::localPosition(), DTEnums::Right, and PV3DBase< T, PVType, FrameType >::x().

                                                                                       {
  // Compute the rechit distance from wire
  return fabs(hitPair.localPosition(DTEnums::Left).x() -
              hitPair.localPosition(DTEnums::Right).x())/2.;
}
float DTRecHitQuality::recHitDistFromWire ( const DTRecHit1D recHit,
const DTLayer layer 
) [private]
float DTRecHitQuality::recHitPositionError ( const DTRecHit1DPair recHit) [private]
float DTRecHitQuality::recHitPositionError ( const DTRecHit1D recHit) [private]

Definition at line 641 of file DTRecHitQuality.cc.

References DTRecHit1D::localPositionError(), mathSSE::sqrt(), and LocalError::xx().

                                                                   {
  return sqrt(recHit.localPositionError().xx());
}
float DTRecHitQuality::simHitDistFromFE ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
) [private]

Definition at line 391 of file DTRecHitQuality.cc.

References DTTopology::cellLenght(), PSimHit::entryPoint(), PSimHit::exitPoint(), DTLayer::specificTopology(), and PV3DBase< T, PVType, FrameType >::y().

                                                            {
  LocalPoint entryP = hit.entryPoint();
  LocalPoint exitP = hit.exitPoint();
  float wireLenght=layer->specificTopology().cellLenght();
  return (entryP.y()+exitP.y())/2.+wireLenght;
}
float DTRecHitQuality::simHitDistFromWire ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
) [private]

Definition at line 368 of file DTRecHitQuality.cc.

References PSimHit::entryPoint(), PSimHit::exitPoint(), DTLayer::specificTopology(), DTWireId::wire(), DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

                                                              {
  float xwire = layer->specificTopology().wirePosition(wireId.wire());
  LocalPoint entryP = hit.entryPoint();
  LocalPoint exitP = hit.exitPoint();
  float xEntry = entryP.x()-xwire;
  float xExit  = exitP.x()-xwire;

  return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));//FIXME: check...
}
float DTRecHitQuality::simHitImpactAngle ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
) [private]

Definition at line 381 of file DTRecHitQuality.cc.

References PSimHit::entryPoint(), PSimHit::exitPoint(), theta(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

                                                             {
  LocalPoint entryP = hit.entryPoint();
  LocalPoint exitP = hit.exitPoint();
  float theta=(exitP.x()-entryP.x())/(exitP.z()-entryP.z());
  return atan(theta);
}

Member Data Documentation

Definition at line 194 of file DTRecHitQuality.h.

bool DTRecHitQuality::debug [private]

Definition at line 70 of file DTRecHitQuality.h.

bool DTRecHitQuality::doall [private]

Definition at line 195 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep1 [private]

Definition at line 79 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep2 [private]

Definition at line 80 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep3 [private]

Definition at line 81 of file DTRecHitQuality.h.

Definition at line 175 of file DTRecHitQuality.h.

Definition at line 179 of file DTRecHitQuality.h.

Definition at line 183 of file DTRecHitQuality.h.

Definition at line 187 of file DTRecHitQuality.h.

Definition at line 191 of file DTRecHitQuality.h.

Definition at line 176 of file DTRecHitQuality.h.

Definition at line 180 of file DTRecHitQuality.h.

Definition at line 184 of file DTRecHitQuality.h.

Definition at line 188 of file DTRecHitQuality.h.

Definition at line 192 of file DTRecHitQuality.h.

Definition at line 177 of file DTRecHitQuality.h.

Definition at line 181 of file DTRecHitQuality.h.

Definition at line 185 of file DTRecHitQuality.h.

Definition at line 189 of file DTRecHitQuality.h.

Definition at line 193 of file DTRecHitQuality.h.

Definition at line 143 of file DTRecHitQuality.h.

Definition at line 163 of file DTRecHitQuality.h.

Definition at line 167 of file DTRecHitQuality.h.

Definition at line 171 of file DTRecHitQuality.h.

Definition at line 147 of file DTRecHitQuality.h.

Definition at line 151 of file DTRecHitQuality.h.

Definition at line 155 of file DTRecHitQuality.h.

Definition at line 159 of file DTRecHitQuality.h.

Definition at line 144 of file DTRecHitQuality.h.

Definition at line 164 of file DTRecHitQuality.h.

Definition at line 168 of file DTRecHitQuality.h.

Definition at line 172 of file DTRecHitQuality.h.

Definition at line 148 of file DTRecHitQuality.h.

Definition at line 152 of file DTRecHitQuality.h.

Definition at line 156 of file DTRecHitQuality.h.

Definition at line 160 of file DTRecHitQuality.h.

Definition at line 145 of file DTRecHitQuality.h.

Definition at line 165 of file DTRecHitQuality.h.

Definition at line 169 of file DTRecHitQuality.h.

Definition at line 173 of file DTRecHitQuality.h.

Definition at line 149 of file DTRecHitQuality.h.

Definition at line 153 of file DTRecHitQuality.h.

Definition at line 157 of file DTRecHitQuality.h.

Definition at line 161 of file DTRecHitQuality.h.

bool DTRecHitQuality::local [private]

Definition at line 82 of file DTRecHitQuality.h.

Definition at line 74 of file DTRecHitQuality.h.

std::string DTRecHitQuality::rootFileName [private]

Definition at line 72 of file DTRecHitQuality.h.

Definition at line 75 of file DTRecHitQuality.h.

Definition at line 76 of file DTRecHitQuality.h.

Definition at line 73 of file DTRecHitQuality.h.