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_S1RPhiWS [3][4]
HEff1DHithEff_S1RZ
HEff1DHithEff_S1RZ_W0
HEff1DHithEff_S1RZ_W1
HEff1DHithEff_S1RZ_W2
HEff1DHithEff_S1RZWS [3][4]
HEff1DHithEff_S2RPhi
HEff1DHithEff_S2RZ
HEff1DHithEff_S2RZ_W0
HEff1DHithEff_S2RZ_W1
HEff1DHithEff_S2RZ_W2
HEff1DHithEff_S3RPhi
HEff1DHithEff_S3RPhiWS [3][4]
HEff1DHithEff_S3RZ
HEff1DHithEff_S3RZ_W0
HEff1DHithEff_S3RZ_W1
HEff1DHithEff_S3RZ_W2
HEff1DHithEff_S3RZWS [3][4]
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_S3RPhiWS [3][4]
HRes1DHithRes_S3RZ
HRes1DHithRes_S3RZ_W0
HRes1DHithRes_S3RZ_W1
HRes1DHithRes_S3RZ_W2
HRes1DHithRes_S3RZWS [3][4]
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

Residual/pull plots are filled for the rechit with distance from wire closer to that of the muon simhit.

Efficiencies are defined as the fraction of muon simhits with a rechit in the same cell, for the given reconstruction step. Hence, for S2 and S3 the definition incorporate the segment reconstruction efficiency.

Author:
G. Cerminara - INFN Torino

Definition at line 49 of file DTRecHitQuality.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 37 of file DTRecHitQuality.cc.

References dbe_, debug, edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, alignCSCRings::s, and w().

                                                        {
  // 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 (local) {
      // Plots with finer granularity, not to be included in DQM
      TString name1="RPhi_W";
      TString name2="RZ_W";
      for (long w=0;w<=2;++w) {
        for (long s=1;s<=4;++s){
          hRes_S3RPhiWS[w][s-1] = new HRes1DHit(("S3"+name1+w+"_St"+s).Data(),dbe_,doall,local); 
          hEff_S1RPhiWS[w][s-1] = new HEff1DHit(("S1"+name1+w+"_St"+s).Data(),dbe_); 
          hEff_S3RPhiWS[w][s-1] = new HEff1DHit(("S3"+name1+w+"_St"+s).Data(),dbe_); 
          if (s!=4) {
            hRes_S3RZWS[w][s-1] = new HRes1DHit(("S3"+name2+w+"_St"+s).Data(),dbe_,doall,local); 
            hEff_S1RZWS[w][s-1] = new HEff1DHit(("S1"+name2+w+"_St"+s).Data(),dbe_); 
            hEff_S3RZWS[w][s-1] = new HEff1DHit(("S3"+name2+w+"_St"+s).Data(),dbe_); 
          }
        }
      }
    }
    
    
    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 147 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 184 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 416 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;
          if (local) hRes_S3RPhiWS[abs(wireId.wheel())][wireId.station()-1]->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),simHitGlobalPos.phi(),recHitErr,wireId.station());
          
        } 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;

          if (local) hRes_S3RZWS[abs(wireId.wheel())][wireId.station()-1]->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),simHitGlobalPos.phi(),recHitErr,wireId.station());
        }
      }
      // 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;
          if (local) hEff_S1RPhiWS[abs(wireId.wheel())][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
        } 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;
          if (local) hEff_S1RZWS[abs(wireId.wheel())][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
        }
        
      } 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;
          if (local) hEff_S3RPhiWS[abs(wireId.wheel())][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
        } 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;
          if (local) hEff_S3RZWS[abs(wireId.wheel())][wireId.station()-1]->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
        }

      }
      // 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]
void DTRecHitQuality::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 151 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 377 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 278 of file DTRecHitQuality.cc.

References run_regression::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 292 of file DTRecHitQuality.cc.

References run_regression::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 314 of file DTRecHitQuality.cc.

References run_regression::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 400 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 621 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 364 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 341 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 354 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 208 of file DTRecHitQuality.h.

bool DTRecHitQuality::debug [private]

Definition at line 75 of file DTRecHitQuality.h.

bool DTRecHitQuality::doall [private]

Definition at line 209 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep1 [private]

Definition at line 84 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep2 [private]

Definition at line 85 of file DTRecHitQuality.h.

bool DTRecHitQuality::doStep3 [private]

Definition at line 86 of file DTRecHitQuality.h.

Definition at line 183 of file DTRecHitQuality.h.

Definition at line 203 of file DTRecHitQuality.h.

Definition at line 187 of file DTRecHitQuality.h.

Definition at line 191 of file DTRecHitQuality.h.

Definition at line 195 of file DTRecHitQuality.h.

Definition at line 199 of file DTRecHitQuality.h.

Definition at line 205 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 196 of file DTRecHitQuality.h.

Definition at line 200 of file DTRecHitQuality.h.

Definition at line 185 of file DTRecHitQuality.h.

Definition at line 204 of file DTRecHitQuality.h.

Definition at line 189 of file DTRecHitQuality.h.

Definition at line 193 of file DTRecHitQuality.h.

Definition at line 197 of file DTRecHitQuality.h.

Definition at line 201 of file DTRecHitQuality.h.

Definition at line 206 of file DTRecHitQuality.h.

Definition at line 148 of file DTRecHitQuality.h.

Definition at line 168 of file DTRecHitQuality.h.

Definition at line 172 of file DTRecHitQuality.h.

Definition at line 176 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 164 of file DTRecHitQuality.h.

Definition at line 149 of file DTRecHitQuality.h.

Definition at line 169 of file DTRecHitQuality.h.

Definition at line 173 of file DTRecHitQuality.h.

Definition at line 177 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.

Definition at line 165 of file DTRecHitQuality.h.

Definition at line 150 of file DTRecHitQuality.h.

Definition at line 170 of file DTRecHitQuality.h.

Definition at line 174 of file DTRecHitQuality.h.

Definition at line 178 of file DTRecHitQuality.h.

Definition at line 180 of file DTRecHitQuality.h.

Definition at line 154 of file DTRecHitQuality.h.

Definition at line 158 of file DTRecHitQuality.h.

Definition at line 162 of file DTRecHitQuality.h.

Definition at line 166 of file DTRecHitQuality.h.

Definition at line 181 of file DTRecHitQuality.h.

bool DTRecHitQuality::local [private]

Definition at line 87 of file DTRecHitQuality.h.

Definition at line 79 of file DTRecHitQuality.h.

std::string DTRecHitQuality::rootFileName [private]

Definition at line 77 of file DTRecHitQuality.h.

Definition at line 80 of file DTRecHitQuality.h.

Definition at line 81 of file DTRecHitQuality.h.

Definition at line 78 of file DTRecHitQuality.h.