CMS 3D CMS Logo

DTRecHitQuality Class Reference

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

#include <Validation/DTRecHits/plugins/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 ()
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 DTRecSegment4DCollection *segment4Ds)
std::map< DTWireId,
std::vector< DTRecHit1D > > 
map1DRecHitsPerWire (const DTRecSegment2DCollection *segment2Ds)
std::map< DTWireId,
std::vector< DTRecHit1DPair > > 
map1DRecHitsPerWire (const DTRecHitCollection *dt1DRecHitPairs)
float recHitDistFromWire (const DTRecHit1D &recHit, const DTLayer *layer)
float recHitDistFromWire (const DTRecHit1DPair &hitPair, const DTLayer *layer)
float recHitPositionError (const DTRecHit1D &recHit)
float recHitPositionError (const DTRecHit1DPair &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

bool debug
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_S1RZ
HRes1DHithRes_S1RZ_W0
HRes1DHithRes_S1RZ_W1
HRes1DHithRes_S1RZ_W2
HRes1DHithRes_S2RPhi
HRes1DHithRes_S2RZ
HRes1DHithRes_S2RZ_W0
HRes1DHithRes_S2RZ_W1
HRes1DHithRes_S2RZ_W2
HRes1DHithRes_S3RPhi
HRes1DHithRes_S3RZ
HRes1DHithRes_S3RZ_W0
HRes1DHithRes_S3RZ_W1
HRes1DHithRes_S3RZ_W2
std::string recHitLabel
std::string rootFileName
std::string segment2DLabel
std::string segment4DLabel
std::string simHitLabel
TFile * theFile


Detailed Description

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

Date
2007/10/25 11:58:37
Revision
1.1
Author:
G. Cerminara - INFN Torino

Definition at line 39 of file DTRecHitQuality.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 36 of file DTRecHitQuality.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, doStep1, doStep2, doStep3, lat::endl(), edm::ParameterSet::getUntrackedParameter(), hEff_S1RPhi, hEff_S1RZ, hEff_S1RZ_W0, hEff_S1RZ_W1, hEff_S1RZ_W2, hEff_S2RPhi, hEff_S2RZ, hEff_S2RZ_W0, hEff_S2RZ_W1, hEff_S2RZ_W2, hEff_S3RPhi, hEff_S3RZ, hEff_S3RZ_W0, hEff_S3RZ_W1, hEff_S3RZ_W2, hRes_S1RPhi, hRes_S1RZ, hRes_S1RZ_W0, hRes_S1RZ_W1, hRes_S1RZ_W2, hRes_S2RPhi, hRes_S2RZ, hRes_S2RZ_W0, hRes_S2RZ_W1, hRes_S2RZ_W2, hRes_S3RPhi, hRes_S3RZ, hRes_S3RZ_W0, hRes_S3RZ_W1, hRes_S3RZ_W2, recHitLabel, rootFileName, segment2DLabel, segment4DLabel, simHitLabel, and theFile.

00036                                                         {
00037   // Get the debug parameter for verbose output
00038   debug = pset.getUntrackedParameter<bool>("debug");
00039   rootFileName = pset.getUntrackedParameter<string>("rootFileName");
00040   // the name of the simhit collection
00041   simHitLabel = pset.getUntrackedParameter<string>("simHitLabel", "SimG4Object");
00042   // the name of the 1D rec hit collection
00043   recHitLabel = pset.getUntrackedParameter<string>("recHitLabel", "DTRecHit1DProducer");
00044   // the name of the 2D rec hit collection
00045   segment2DLabel = pset.getUntrackedParameter<string>("segment2DLabel");
00046   // the name of the 4D rec hit collection
00047   segment4DLabel = pset.getUntrackedParameter<string>("segment4DLabel");
00048 
00049   // Switches for analysis at various steps
00050   doStep1 = pset.getUntrackedParameter<bool>("doStep1", false);
00051   doStep2 = pset.getUntrackedParameter<bool>("doStep2", false);
00052   doStep3 = pset.getUntrackedParameter<bool>("doStep3", false);
00053 
00054 
00055   if(debug)
00056     cout << "[DTRecHitQuality] Constructor called" << endl;
00057 
00058   // Create the root file
00059   theFile = new TFile(rootFileName.c_str(), "RECREATE");
00060   theFile->cd();
00061 
00062 
00063   hRes_S1RPhi= new HRes1DHit("S1RPhi");     // RecHits, 1. step, RPhi
00064   hRes_S2RPhi= new HRes1DHit("S2RPhi");     // RecHits, 2. step, RPhi
00065   hRes_S3RPhi= new HRes1DHit("S3RPhi");     // RecHits, 3. step, RPhi
00066 
00067   hRes_S1RZ= new HRes1DHit("S1RZ");         // RecHits, 1. step, RZ
00068   hRes_S2RZ= new HRes1DHit("S2RZ");         // RecHits, 2. step, RZ
00069   hRes_S3RZ= new HRes1DHit("S3RZ");         // RecHits, 3. step, RZ
00070 
00071   hRes_S1RZ_W0= new HRes1DHit("S1RZ_W0");   // RecHits, 1. step, RZ, wheel 0
00072   hRes_S2RZ_W0= new HRes1DHit("S2RZ_W0");   // RecHits, 2. step, RZ, wheel 0
00073   hRes_S3RZ_W0= new HRes1DHit("S3RZ_W0");   // RecHits, 3. step, RZ, wheel 0
00074 
00075   hRes_S1RZ_W1= new HRes1DHit("S1RZ_W1");   // RecHits, 1. step, RZ, wheel +-1
00076   hRes_S2RZ_W1= new HRes1DHit("S2RZ_W1");   // RecHits, 2. step, RZ, wheel +-1
00077   hRes_S3RZ_W1= new HRes1DHit("S3RZ_W1");   // RecHits, 3. step, RZ, wheel +-1
00078 
00079   hRes_S1RZ_W2= new HRes1DHit("S1RZ_W2");   // RecHits, 1. step, RZ, wheel +-2
00080   hRes_S2RZ_W2= new HRes1DHit("S2RZ_W2");   // RecHits, 2. step, RZ, wheel +-2
00081   hRes_S3RZ_W2= new HRes1DHit("S3RZ_W2");   // RecHits, 3. step, RZ, wheel +-2
00082 
00083   hEff_S1RPhi= new HEff1DHit("S1RPhi");     // RecHits, 1. step, RPhi
00084   hEff_S2RPhi= new HEff1DHit("S2RPhi");     // RecHits, 2. step, RPhi
00085   hEff_S3RPhi= new HEff1DHit("S3RPhi");     // RecHits, 3. step, RPhi
00086 
00087   hEff_S1RZ= new HEff1DHit("S1RZ");         // RecHits, 1. step, RZ
00088   hEff_S2RZ= new HEff1DHit("S2RZ");         // RecHits, 2. step, RZ
00089   hEff_S3RZ= new HEff1DHit("S3RZ");         // RecHits, 3. step, RZ
00090 
00091   hEff_S1RZ_W0= new HEff1DHit("S1RZ_W0");   // RecHits, 1. step, RZ, wheel 0
00092   hEff_S2RZ_W0= new HEff1DHit("S2RZ_W0");   // RecHits, 2. step, RZ, wheel 0
00093   hEff_S3RZ_W0= new HEff1DHit("S3RZ_W0");   // RecHits, 3. step, RZ, wheel 0
00094 
00095   hEff_S1RZ_W1= new HEff1DHit("S1RZ_W1");   // RecHits, 1. step, RZ, wheel +-1
00096   hEff_S2RZ_W1= new HEff1DHit("S2RZ_W1");   // RecHits, 2. step, RZ, wheel +-1
00097   hEff_S3RZ_W1= new HEff1DHit("S3RZ_W1");   // RecHits, 3. step, RZ, wheel +-1
00098 
00099   hEff_S1RZ_W2= new HEff1DHit("S1RZ_W2");   // RecHits, 1. step, RZ, wheel +-2
00100   hEff_S2RZ_W2= new HEff1DHit("S2RZ_W2");   // RecHits, 2. step, RZ, wheel +-2
00101   hEff_S3RZ_W2= new HEff1DHit("S3RZ_W2");   // RecHits, 3. step, RZ, wheel +-2
00102 }

DTRecHitQuality::~DTRecHitQuality (  )  [virtual]

Destructor.

Definition at line 107 of file DTRecHitQuality.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, and lat::endl().

00107                                    {
00108     if(debug) 
00109       cout << "[DTRecHitQuality] Destructor called" << endl;
00110   }


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 compute(), GenMuonPlsPt100GeV_cfg::cout, debug, doStep1, doStep2, doStep3, lat::endl(), edm::EventSetup::get(), map1DRecHitsPerWire(), DTHitQualityUtils::mapSimHitsPerWire(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), recHitLabel, segment2DLabel, segment4DLabel, simHitLabel, trackerHits::simHits, and theFile.

00184                                                                                 {
00185     if(debug)
00186       cout << "--- [DTRecHitQuality] Analysing Event: #Run: " << event.id().run()
00187         << " #Event: " << event.id().event() << endl;
00188     theFile->cd();
00189     // Get the DT Geometry
00190     ESHandle<DTGeometry> dtGeom;
00191     eventSetup.get<MuonGeometryRecord>().get(dtGeom);
00192 
00193 
00194     // Get the SimHit collection from the event
00195     Handle<PSimHitContainer> simHits;
00196     event.getByLabel(simHitLabel, "MuonDTHits", simHits);
00197 
00198     // Map simhits per wire
00199     map<DTWireId, PSimHitContainer > simHitsPerWire =
00200       DTHitQualityUtils::mapSimHitsPerWire(*(simHits.product()));
00201 
00202 
00203 
00204 
00205     //=======================================================================================
00206     // RecHit analysis at Step 1
00207     if(doStep1) {
00208       if(debug)
00209         cout << "  -- DTRecHit S1: begin analysis:" << endl;
00210       // Get the rechit collection from the event
00211       Handle<DTRecHitCollection> dtRecHits;
00212       event.getByLabel(recHitLabel, dtRecHits);
00213 
00214       // Map rechits per wire
00215       map<DTWireId,vector<DTRecHit1DPair> > recHitsPerWire = 
00216         map1DRecHitsPerWire(dtRecHits.product());
00217 
00218       compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 1);
00219     }
00220 
00221 
00222 
00223     //=======================================================================================
00224     // RecHit analysis at Step 2
00225     if(doStep2) {
00226       if(debug)
00227         cout << "  -- DTRecHit S2: begin analysis:" << endl;
00228 
00229       // Get the 2D rechits from the event
00230       Handle<DTRecSegment2DCollection> segment2Ds;
00231       event.getByLabel(segment2DLabel, segment2Ds);
00232 
00233       // Map rechits per wire
00234       map<DTWireId,vector<DTRecHit1D> > recHitsPerWire = 
00235         map1DRecHitsPerWire(segment2Ds.product());
00236 
00237       compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 2);
00238     }
00239 
00240 
00241     //=======================================================================================
00242     // RecHit analysis at Step 3
00243     if(doStep3) {
00244       if(debug)
00245         cout << "  -- DTRecHit S3: begin analysis:" << endl;
00246 
00247       // Get the 4D rechits from the event
00248       Handle<DTRecSegment4DCollection> segment4Ds;
00249       event.getByLabel(segment4DLabel, segment4Ds);
00250 
00251       // Map rechits per wire
00252       map<DTWireId,vector<DTRecHit1D> > recHitsPerWire = 
00253         map1DRecHitsPerWire(segment4Ds.product());
00254 
00255       compute(dtGeom.product(), simHitsPerWire, recHitsPerWire, 3);
00256     }
00257 
00258   }

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 
) [inline, private]

Definition at line 402 of file DTRecHitQuality.cc.

References funct::abs(), GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), PV3DBase< T, PVType, FrameType >::eta(), HRes1DHit::Fill(), HEff1DHit::Fill(), findBestRecHit(), DTHitQualityUtils::findMuSimHit(), hEff_S1RPhi, hEff_S1RZ, hEff_S1RZ_W0, hEff_S1RZ_W1, hEff_S1RZ_W2, hEff_S2RPhi, hEff_S2RZ, hEff_S2RZ_W0, hEff_S2RZ_W1, hEff_S2RZ_W2, hEff_S3RPhi, hEff_S3RZ, hEff_S3RZ_W0, hEff_S3RZ_W1, hEff_S3RZ_W2, hRes_S1RPhi, hRes_S1RZ, hRes_S1RZ_W0, hRes_S1RZ_W1, hRes_S1RZ_W2, hRes_S2RPhi, hRes_S2RZ, hRes_S2RZ_W0, hRes_S2RZ_W1, hRes_S2RZ_W2, hRes_S3RPhi, hRes_S3RZ, hRes_S3RZ_W0, hRes_S3RZ_W1, hRes_S3RZ_W2, DTGeometry::layer(), PSimHit::localPosition(), PV3DBase< T, PVType, FrameType >::phi(), recHitDistFromWire(), recHitPositionError(), simHitDistFromFE(), simHitDistFromWire(), simHitImpactAngle(), DTSuperLayerId::superLayer(), DTSuperLayerId::superlayer(), GeomDet::toGlobal(), and DTChamberId::wheel().

Referenced by analyze().

00405                                         {
00406   // Loop over cells with a muon SimHit
00407   for(map<DTWireId, vector<PSimHit> >::const_iterator wireAndSHits = simHitsPerWire.begin();
00408       wireAndSHits != simHitsPerWire.end();
00409       wireAndSHits++) {
00410     DTWireId wireId = (*wireAndSHits).first;
00411     vector<PSimHit> simHitsInCell = (*wireAndSHits).second;
00412 
00413     // Get the layer
00414     const DTLayer* layer = dtGeom->layer(wireId);
00415 
00416     // Look for a mu hit in the cell
00417     const PSimHit* muSimHit = DTHitQualityUtils::findMuSimHit(simHitsInCell);
00418     if (muSimHit==0) {
00419       if (debug) 
00420         cout << "   No mu SimHit in channel: " << wireId << ", skipping! " << endl;
00421       continue; // Skip this cell
00422     }
00423 
00424     // Find the distance of the simhit from the wire
00425     float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
00426     // Skip simhits out of the cell
00427     if(simHitWireDist>2.1) {
00428       if(debug) 
00429         cout << "  [DTRecHitQuality]###Warning: The mu SimHit in out of the cell, skipping!" << endl;
00430       continue; // Skip this cell
00431     }
00432     GlobalPoint simHitGlobalPos = layer->toGlobal(muSimHit->localPosition());
00433 
00434     // find SH impact angle
00435     float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
00436 
00437     // find SH distance from FE
00438     float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
00439 
00440     bool recHitReconstructed = false;
00441 
00442     // Look for RecHits in the same cell
00443     if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
00444       // No RecHit found in this cell
00445       if(debug)
00446         cout << "   No RecHit found at Step: " << step << " in cell: " << wireId << endl;
00447     } else {
00448       recHitReconstructed = true;
00449       // vector<type> recHits = (*wireAndRecHits).second;
00450       vector<type> recHits = recHitsPerWire[wireId];
00451       if(debug)
00452         cout << "   " << recHits.size() << " RecHits, Step " << step << " in channel: " << wireId << endl;
00453 
00454       // Find the best RecHit
00455       const type* theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
00456 
00457 
00458       float recHitWireDist =  recHitDistFromWire(*theBestRecHit, layer);
00459       if(debug)
00460         cout << "    SimHit distance from wire: " << simHitWireDist << endl
00461           << "    SimHit distance from FE: " << simHitFEDist << endl
00462           << "    SimHit distance angle " << simHitTheta << endl
00463           << "    RecHit distance from wire: " << recHitWireDist << endl;
00464       float recHitErr = recHitPositionError(*theBestRecHit);
00465 
00466       HRes1DHit *hRes = 0;
00467       HRes1DHit *hResTot = 0;
00468 
00469       // Fill residuals and pulls
00470       // Select the histo to be filled
00471       if(step == 1) {
00472         // Step 1
00473         if(wireId.superLayer() != 2) {
00474           hRes = hRes_S1RPhi;
00475         } else {
00476           hResTot = hRes_S1RZ;
00477           if(wireId.wheel() == 0)
00478             hRes = hRes_S1RZ_W0;
00479           if(abs(wireId.wheel()) == 1)
00480             hRes = hRes_S1RZ_W1;
00481           if(abs(wireId.wheel()) == 2)
00482             hRes = hRes_S1RZ_W2;
00483         }
00484 
00485       } else if(step == 2) {
00486         // Step 2
00487         if(wireId.superlayer() != 2) {
00488           hRes = hRes_S2RPhi;
00489         } else {
00490           hResTot = hRes_S2RZ;
00491           if(wireId.wheel() == 0)
00492             hRes = hRes_S2RZ_W0;
00493           if(abs(wireId.wheel()) == 1)
00494             hRes = hRes_S2RZ_W1;
00495           if(abs(wireId.wheel()) == 2)
00496             hRes = hRes_S2RZ_W2;
00497         }
00498 
00499       } else if(step == 3) {
00500         // Step 3
00501         if(wireId.superlayer() != 2) {
00502           hRes = hRes_S3RPhi;
00503         } else {
00504           hResTot = hRes_S3RZ;
00505           if(wireId.wheel() == 0)
00506             hRes = hRes_S3RZ_W0;
00507           if(abs(wireId.wheel()) == 1)
00508             hRes = hRes_S3RZ_W1;
00509           if(abs(wireId.wheel()) == 2)
00510             hRes = hRes_S3RZ_W2;
00511         }
00512 
00513       }
00514       // Fill
00515       hRes->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
00516                  simHitGlobalPos.phi(),recHitErr);
00517       if(hResTot != 0)
00518         hResTot->Fill(simHitWireDist, simHitTheta, simHitFEDist, recHitWireDist, simHitGlobalPos.eta(),
00519                       simHitGlobalPos.phi(),recHitErr);
00520 
00521     }
00522 
00523     // Fill Efficiencies
00524     HEff1DHit *hEff = 0;
00525     HEff1DHit *hEffTot = 0;
00526 
00527     if(step == 1) {
00528       // Step 1
00529       if(wireId.superlayer() != 2) {
00530         hEff = hEff_S1RPhi;
00531       } else {
00532         hEffTot = hEff_S1RZ;
00533         if(wireId.wheel() == 0)
00534           hEff = hEff_S1RZ_W0;
00535         if(abs(wireId.wheel()) == 1)
00536           hEff = hEff_S1RZ_W1;
00537         if(abs(wireId.wheel()) == 2)
00538           hEff = hEff_S1RZ_W2;
00539       }
00540 
00541     } else if(step == 2) {
00542       // Step 2
00543       if(wireId.superlayer() != 2) {
00544         hEff = hEff_S2RPhi;
00545       } else {
00546         hEffTot = hEff_S2RZ;
00547         if(wireId.wheel() == 0)
00548           hEff = hEff_S2RZ_W0;
00549         if(abs(wireId.wheel()) == 1)
00550           hEff = hEff_S2RZ_W1;
00551         if(abs(wireId.wheel()) == 2)
00552           hEff = hEff_S2RZ_W2;
00553       }
00554 
00555     } else if(step == 3) {
00556       // Step 3
00557       if(wireId.superlayer() != 2) {
00558         hEff = hEff_S3RPhi;
00559       } else {
00560         hEffTot = hEff_S3RZ;
00561         if(wireId.wheel() == 0)
00562           hEff = hEff_S3RZ_W0;
00563         if(abs(wireId.wheel()) == 1)
00564           hEff = hEff_S3RZ_W1;
00565         if(abs(wireId.wheel()) == 2)
00566           hEff = hEff_S3RZ_W2;
00567       }
00568 
00569     }
00570     // Fill
00571     hEff->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
00572     if(hEffTot != 0)
00573       hEffTot->Fill(simHitWireDist, simHitGlobalPos.eta(), simHitGlobalPos.phi(), recHitReconstructed);
00574   }
00575 }

void DTRecHitQuality::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 114 of file DTRecHitQuality.cc.

References HEff1DHit::ComputeEfficiency(), hEff_S1RPhi, hEff_S1RZ, hEff_S1RZ_W0, hEff_S1RZ_W1, hEff_S1RZ_W2, hEff_S2RPhi, hEff_S2RZ, hEff_S2RZ_W0, hEff_S2RZ_W1, hEff_S2RZ_W2, hEff_S3RPhi, hEff_S3RZ, hEff_S3RZ_W0, hEff_S3RZ_W1, hEff_S3RZ_W2, hRes_S1RPhi, hRes_S1RZ, hRes_S1RZ_W0, hRes_S1RZ_W1, hRes_S1RZ_W2, hRes_S2RPhi, hRes_S2RZ, hRes_S2RZ_W0, hRes_S2RZ_W1, hRes_S2RZ_W2, hRes_S3RPhi, hRes_S3RZ, hRes_S3RZ_W0, hRes_S3RZ_W1, hRes_S3RZ_W2, theFile, HEff1DHit::Write(), and HRes1DHit::Write().

00114                              {
00115   // Write the histos to file
00116   theFile->cd();
00117 
00118   hEff_S1RPhi->ComputeEfficiency();
00119   hEff_S2RPhi->ComputeEfficiency();
00120   hEff_S3RPhi->ComputeEfficiency();
00121 
00122   hEff_S1RZ->ComputeEfficiency();
00123   hEff_S2RZ->ComputeEfficiency();
00124   hEff_S3RZ->ComputeEfficiency();
00125 
00126   hEff_S1RZ_W0->ComputeEfficiency();
00127   hEff_S2RZ_W0->ComputeEfficiency();
00128   hEff_S3RZ_W0->ComputeEfficiency();
00129 
00130   hEff_S1RZ_W1->ComputeEfficiency();
00131   hEff_S2RZ_W1->ComputeEfficiency();
00132   hEff_S3RZ_W1->ComputeEfficiency();
00133 
00134   hEff_S1RZ_W2->ComputeEfficiency();
00135   hEff_S2RZ_W2->ComputeEfficiency();
00136   hEff_S3RZ_W2->ComputeEfficiency();
00137 
00138   // Write histos to file
00139   hRes_S1RPhi->Write();
00140   hRes_S2RPhi->Write();
00141   hRes_S3RPhi->Write();
00142 
00143   hRes_S1RZ->Write();
00144   hRes_S2RZ->Write();
00145   hRes_S3RZ->Write();
00146 
00147   hRes_S1RZ_W0->Write();
00148   hRes_S2RZ_W0->Write();
00149   hRes_S3RZ_W0->Write();
00150 
00151   hRes_S1RZ_W1->Write();
00152   hRes_S2RZ_W1->Write();
00153   hRes_S3RZ_W1->Write();
00154 
00155   hRes_S1RZ_W2->Write();
00156   hRes_S2RZ_W2->Write();
00157   hRes_S3RZ_W2->Write();
00158 
00159 
00160   hEff_S1RPhi->Write();
00161   hEff_S2RPhi->Write();
00162   hEff_S3RPhi->Write();
00163 
00164   hEff_S1RZ->Write();
00165   hEff_S2RZ->Write();
00166   hEff_S3RZ->Write();
00167 
00168   hEff_S1RZ_W0->Write();
00169   hEff_S2RZ_W0->Write();
00170   hEff_S3RZ_W0->Write();
00171 
00172   hEff_S1RZ_W1->Write();
00173   hEff_S2RZ_W1->Write();
00174   hEff_S3RZ_W1->Write();
00175 
00176   hEff_S1RZ_W2->Write();
00177   hEff_S2RZ_W2->Write();
00178   hEff_S3RZ_W2->Write();
00179 
00180   theFile->Close();
00181 }

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

Definition at line 363 of file DTRecHitQuality.cc.

References recHitDistFromWire(), and res.

00366                                                         {
00367   float res = 99999;
00368   const type* theBestRecHit = 0;
00369   // Loop over RecHits within the cell
00370   for(typename vector<type>::const_iterator recHit = recHits.begin();
00371       recHit != recHits.end();
00372       recHit++) {
00373     float distTmp = recHitDistFromWire(*recHit, layer);
00374     if(fabs(distTmp-simHitDist) < res) {
00375       res = fabs(distTmp-simHitDist);
00376       theBestRecHit = &(*recHit);
00377     }
00378   } // End of loop over RecHits within the cell
00379 
00380   return theBestRecHit;
00381 }

template<typename type>
const type* DTRecHitQuality::findBestRecHit ( const DTLayer layer,
DTWireId  wireId,
const std::vector< type > &  recHits,
const float  simHitDist 
) [inline, private]

Referenced by compute().

map< DTWireId, std::vector< DTRecHit1D > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecSegment4DCollection segment4Ds  )  [private]

Definition at line 300 of file DTRecHitQuality.cc.

References DTRecHit1D::wireId().

00300                                                                                {
00301   map<DTWireId, vector<DTRecHit1D> > ret;
00302   // Loop over all 4D segments
00303   for(DTRecSegment4DCollection::const_iterator segment = segment4Ds->begin();
00304       segment != segment4Ds->end();
00305       segment++) {
00306     // Get component 2D segments
00307     vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
00308     // Loop over 2D segments:
00309     for(vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin();
00310         segment2D != segment2Ds.end();
00311         segment2D++) {
00312       // Get 1D component rechits
00313       vector<const TrackingRecHit*> hits = (*segment2D)->recHits();
00314       // Loop over them
00315       for(vector<const TrackingRecHit*>::const_iterator hit = hits.begin();
00316           hit != hits.end(); hit++) {
00317         const DTRecHit1D* hit1D = dynamic_cast<const DTRecHit1D*>(*hit);
00318         ret[hit1D->wireId()].push_back(*hit1D);
00319       }
00320     }
00321   }
00322 
00323   return ret;
00324 }

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

Definition at line 278 of file DTRecHitQuality.cc.

00278                                                                                {
00279   map<DTWireId, vector<DTRecHit1D> > ret;
00280 
00281   // Loop over all 2D segments
00282   for(DTRecSegment2DCollection::const_iterator segment = segment2Ds->begin();
00283       segment != segment2Ds->end();
00284       segment++) {
00285     vector<DTRecHit1D> component1DHits= (*segment).specificRecHits();
00286     // Loop over all component 1D hits
00287     for(vector<DTRecHit1D>::const_iterator hit = component1DHits.begin();
00288         hit != component1DHits.end();
00289         hit++) {
00290       ret[(*hit).wireId()].push_back(*hit);
00291     }
00292   }
00293   return ret;
00294 }

map< DTWireId, vector< DTRecHit1DPair > > DTRecHitQuality::map1DRecHitsPerWire ( const DTRecHitCollection dt1DRecHitPairs  )  [private]

Definition at line 264 of file DTRecHitQuality.cc.

Referenced by analyze().

00264                                                                               {
00265   map<DTWireId, vector<DTRecHit1DPair> > ret;
00266 
00267   for(DTRecHitCollection::const_iterator rechit = dt1DRecHitPairs->begin();
00268       rechit != dt1DRecHitPairs->end(); rechit++) {
00269     ret[(*rechit).wireId()].push_back(*rechit);
00270   }
00271 
00272   return ret;
00273 }

float DTRecHitQuality::recHitDistFromWire ( const DTRecHit1D recHit,
const DTLayer layer 
) [private]

Definition at line 396 of file DTRecHitQuality.cc.

References DTRecHit1D::localPosition(), DTLayer::specificTopology(), DTWireId::wire(), DTRecHit1D::wireId(), DTTopology::wirePosition(), and PV3DBase< T, PVType, FrameType >::x().

00396                                                                                   {
00397   return fabs(recHit.localPosition().x() - layer->specificTopology().wirePosition(recHit.wireId().wire()));
00398 }

float DTRecHitQuality::recHitDistFromWire ( const DTRecHit1DPair hitPair,
const DTLayer layer 
) [private]

Definition at line 386 of file DTRecHitQuality.cc.

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

Referenced by compute(), and findBestRecHit().

00386                                                                                        {
00387   // Compute the rechit distance from wire
00388   return fabs(hitPair.localPosition(DTEnums::Left).x() -
00389               hitPair.localPosition(DTEnums::Right).x())/2.;
00390 }

float DTRecHitQuality::recHitPositionError ( const DTRecHit1D recHit  )  [private]

Definition at line 583 of file DTRecHitQuality.cc.

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

00583                                                                    {
00584   return sqrt(recHit.localPositionError().xx());
00585 }

float DTRecHitQuality::recHitPositionError ( const DTRecHit1DPair recHit  )  [private]

Definition at line 578 of file DTRecHitQuality.cc.

References DTEnums::Left, DTRecHit1DPair::localPositionError(), funct::sqrt(), and LocalError::xx().

Referenced by compute().

00578                                                                        {
00579   return sqrt(recHit.localPositionError(DTEnums::Left).xx());
00580 }

float DTRecHitQuality::simHitDistFromFE ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
) [private]

Definition at line 350 of file DTRecHitQuality.cc.

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

Referenced by compute().

00352                                                             {
00353   LocalPoint entryP = hit.entryPoint();
00354   LocalPoint exitP = hit.exitPoint();
00355   float wireLenght=layer->specificTopology().cellLenght();
00356   return (entryP.y()+exitP.y())/2.+wireLenght;
00357 }

float DTRecHitQuality::simHitDistFromWire ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
) [private]

Definition at line 327 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().

Referenced by compute().

00329                                                               {
00330   float xwire = layer->specificTopology().wirePosition(wireId.wire());
00331   LocalPoint entryP = hit.entryPoint();
00332   LocalPoint exitP = hit.exitPoint();
00333   float xEntry = entryP.x()-xwire;
00334   float xExit  = exitP.x()-xwire;
00335 
00336   return fabs(xEntry - (entryP.z()*(xExit-xEntry))/(exitP.z()-entryP.z()));//FIXME: check...
00337 }

float DTRecHitQuality::simHitImpactAngle ( const DTLayer layer,
DTWireId  wireId,
const PSimHit hit 
) [private]

Definition at line 340 of file DTRecHitQuality.cc.

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

Referenced by compute().

00342                                                              {
00343   LocalPoint entryP = hit.entryPoint();
00344   LocalPoint exitP = hit.exitPoint();
00345   float theta=(exitP.x()-entryP.x())/(exitP.z()-entryP.z());
00346   return atan(theta);
00347 }


Member Data Documentation

bool DTRecHitQuality::debug [private]

Definition at line 62 of file DTRecHitQuality.h.

Referenced by analyze(), compute(), DTRecHitQuality(), and ~DTRecHitQuality().

bool DTRecHitQuality::doStep1 [private]

Definition at line 71 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

bool DTRecHitQuality::doStep2 [private]

Definition at line 72 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

bool DTRecHitQuality::doStep3 [private]

Definition at line 73 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

HEff1DHit* DTRecHitQuality::hEff_S1RPhi [private]

Definition at line 156 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S1RZ [private]

Definition at line 160 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S1RZ_W0 [private]

Definition at line 164 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S1RZ_W1 [private]

Definition at line 168 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S1RZ_W2 [private]

Definition at line 172 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S2RPhi [private]

Definition at line 157 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S2RZ [private]

Definition at line 161 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S2RZ_W0 [private]

Definition at line 165 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S2RZ_W1 [private]

Definition at line 169 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S2RZ_W2 [private]

Definition at line 173 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S3RPhi [private]

Definition at line 158 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S3RZ [private]

Definition at line 162 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S3RZ_W0 [private]

Definition at line 166 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S3RZ_W1 [private]

Definition at line 170 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HEff1DHit* DTRecHitQuality::hEff_S3RZ_W2 [private]

Definition at line 174 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S1RPhi [private]

Definition at line 135 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S1RZ [private]

Definition at line 139 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S1RZ_W0 [private]

Definition at line 143 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S1RZ_W1 [private]

Definition at line 147 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S1RZ_W2 [private]

Definition at line 151 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S2RPhi [private]

Definition at line 136 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S2RZ [private]

Definition at line 140 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S2RZ_W0 [private]

Definition at line 144 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S2RZ_W1 [private]

Definition at line 148 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S2RZ_W2 [private]

Definition at line 152 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S3RPhi [private]

Definition at line 137 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S3RZ [private]

Definition at line 141 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S3RZ_W0 [private]

Definition at line 145 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S3RZ_W1 [private]

Definition at line 149 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

HRes1DHit* DTRecHitQuality::hRes_S3RZ_W2 [private]

Definition at line 153 of file DTRecHitQuality.h.

Referenced by compute(), DTRecHitQuality(), and endJob().

std::string DTRecHitQuality::recHitLabel [private]

Definition at line 66 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

std::string DTRecHitQuality::rootFileName [private]

Definition at line 64 of file DTRecHitQuality.h.

Referenced by DTRecHitQuality().

std::string DTRecHitQuality::segment2DLabel [private]

Definition at line 67 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

std::string DTRecHitQuality::segment4DLabel [private]

Definition at line 68 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

std::string DTRecHitQuality::simHitLabel [private]

Definition at line 65 of file DTRecHitQuality.h.

Referenced by analyze(), and DTRecHitQuality().

TFile* DTRecHitQuality::theFile [private]

Definition at line 60 of file DTRecHitQuality.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:59 2009 for CMSSW by  doxygen 1.5.4