CMS 3D CMS Logo

Public Member Functions | Private Attributes

SiPixelHitEfficiencySource Class Reference

#include <SiPixelHitEfficiencySource.h>

Inheritance diagram for SiPixelHitEfficiencySource:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginRun (const edm::Run &r, edm::EventSetup const &iSetup)
virtual void endJob (void)
 SiPixelHitEfficiencySource (const edm::ParameterSet &)
 ~SiPixelHitEfficiencySource ()

Private Attributes

bool applyEdgeCut_
bool bladeOn
DQMStoredbe_
bool debug_
bool diskOn
bool firstRun
bool ladOn
bool layOn
bool modOn
int nmissing
double nSigma_EdgeCut_
int nvalid
int nvtx_
bool phiOn
edm::ParameterSet pSet_
bool ringOn
edm::InputTag src_
std::map< uint32_t,
SiPixelHitEfficiencyModule * > 
theSiPixelStructure
edm::InputTag tracksrc_
double vtxchi2_
double vtxD0_
double vtxndof_
int vtxntrk_
double vtxX_
double vtxY_
double vtxZ_

Detailed Description

Definition at line 40 of file SiPixelHitEfficiencySource.h.


Constructor & Destructor Documentation

SiPixelHitEfficiencySource::SiPixelHitEfficiencySource ( const edm::ParameterSet pSet) [explicit]

Definition at line 63 of file SiPixelHitEfficiencySource.cc.

References applyEdgeCut_, bladeOn, dbe_, debug_, diskOn, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ladOn, layOn, modOn, nSigma_EdgeCut_, cppFunctionSkipper::operator, phiOn, pSet_, ringOn, and tracksrc_.

                                                                                  :
  pSet_(pSet),
  modOn( pSet.getUntrackedParameter<bool>("modOn",true) ),
  ladOn( pSet.getUntrackedParameter<bool>("ladOn",false) ), 
  layOn( pSet.getUntrackedParameter<bool>("layOn",false) ), 
  phiOn( pSet.getUntrackedParameter<bool>("phiOn",false) ), 
  ringOn( pSet.getUntrackedParameter<bool>("ringOn",false) ), 
  bladeOn( pSet.getUntrackedParameter<bool>("bladeOn",false) ), 
  diskOn( pSet.getUntrackedParameter<bool>("diskOn",false) )
  //updateEfficiencies( pSet.getUntrackedParameter<bool>("updateEfficiencies",false) )
 { 
   pSet_ = pSet; 
   debug_ = pSet_.getUntrackedParameter<bool>("debug", false); 
   tracksrc_ = pSet_.getParameter<edm::InputTag>("trajectoryInput");
   applyEdgeCut_ = pSet_.getUntrackedParameter<bool>("applyEdgeCut");
   nSigma_EdgeCut_ = pSet_.getUntrackedParameter<double>("nSigma_EdgeCut");
   dbe_ = edm::Service<DQMStore>().operator->();

  LogInfo("PixelDQM") << "SiPixelHitEfficiencySource constructor" << endl;
  LogInfo ("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/" 
            << layOn << "/" << phiOn << std::endl;
  LogInfo ("PixelDQM") << "Blade/Disk/Ring" << bladeOn << "/" << diskOn << "/" 
            << ringOn << std::endl;
}
SiPixelHitEfficiencySource::~SiPixelHitEfficiencySource ( )

Definition at line 89 of file SiPixelHitEfficiencySource.cc.

References theSiPixelStructure.

                                                        {
  LogInfo("PixelDQM") << "SiPixelHitEfficiencySource destructor" << endl;

  std::map<uint32_t,SiPixelHitEfficiencyModule*>::iterator struct_iter;
  for (struct_iter = theSiPixelStructure.begin() ; struct_iter != theSiPixelStructure.end() ; struct_iter++){
    delete struct_iter->second;
    struct_iter->second = 0;
  }
}

Member Function Documentation

void SiPixelHitEfficiencySource::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 191 of file SiPixelHitEfficiencySource.cc.

References abs, edmNew::DetSetVector< T >::begin(), edm::AssociationMap< Tag >::begin(), bladeOn, gather_cfg::cout, funct::D, debug_, PixelEndcapName::diskName(), diskOn, edmNew::DetSetVector< T >::end(), edm::AssociationMap< Tag >::end(), edm::EventSetup::get(), edm::Event::getByLabel(), i, edmNew::DetSetVector< T >::id(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), PixelBarrelName::isHalfModule(), edm::HandleBase::isValid(), edm::ESHandleBase::isValid(), edm::Ref< C, T, F >::key(), ladOn, PixelBarrelName::layerName(), layOn, ClusterParameterEstimator< T >::localParameters(), TrajectoryStateOnSurface::localParameters(), TrajectoryStateOnSurface::localPosition(), match(), combine::missing, modOn, nmissing, nvalid, nvtx_, PixelEndcapName::pannelName(), phiOn, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, PixelEndcapName::plaquetteName(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), ringOn, edm::AssociationMap< Tag >::size(), mathSSE::sqrt(), DetId::subdetId(), StripSubdetector::TEC, theSiPixelStructure, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, patCandidatesForDimuonsSequences_cff::tracker, align::Tracker, tracksrc_, TrackValidation_HighPurity_cff::valid, vtxchi2_, vtxD0_, vtxndof_, vtxntrk_, vtxX_, vtxY_, vtxZ_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

                                                                                            {

  edm::Handle<reco::VertexCollection> vertexCollectionHandle;
  iEvent.getByLabel("offlinePrimaryVertices", vertexCollectionHandle);
  if(!vertexCollectionHandle.isValid()) return;
  nvtx_=0;
  vtxntrk_=-9999;
  vtxD0_=-9999.; vtxX_=-9999.; vtxY_=-9999.; vtxZ_=-9999.; vtxndof_=-9999.; vtxchi2_=-9999.;
  const reco::VertexCollection & vertices = *vertexCollectionHandle.product();
  reco::VertexCollection::const_iterator bestVtx=vertices.end();
  for(reco::VertexCollection::const_iterator it=vertices.begin(); it!=vertices.end(); ++it){
    if(!it->isValid()) continue;
    if(vtxntrk_==-9999 ||
       vtxntrk_<int(it->tracksSize()) ||
       (vtxntrk_==int(it->tracksSize()) && fabs(vtxZ_)>fabs(it->z()))){
      vtxntrk_=it->tracksSize();
      vtxD0_=it->position().rho();
      vtxX_=it->x();
      vtxY_=it->y();
      vtxZ_=it->z();
      vtxndof_=it->ndof();
      vtxchi2_=it->chi2();
      bestVtx=it;
    }
    if(fabs(it->z())<=20. && fabs(it->position().rho())<=2. && it->ndof()>4) nvtx_++;
  }
  if(nvtx_<1) return;
    
  //Get the geometry
  ESHandle<TrackerGeometry> TG;
  iSetup.get<TrackerDigiGeometryRecord>().get(TG);
  const TrackerGeometry* theTrackerGeometry = TG.product();
  
  //get the map
  edm::Handle<TrajTrackAssociationCollection> match;
  iEvent.getByLabel(tracksrc_,match);  
  const TrajTrackAssociationCollection ttac = *(match.product());

  if(debug_){
    //std::cout << "Trajectories\t : " << trajColl.size() << std::endl;
    //std::cout << "recoTracks  \t : " << trackColl.size() << std::endl;
    std::cout << "+++ NEW EVENT +++"<< std::endl;
    std::cout << "Map entries \t : " << ttac.size() << std::endl;
  }

  std::set<SiPixelCluster> clusterSet;
  TrajectoryStateCombiner tsoscomb;

  //Loop over map entries
  for(TrajTrackAssociationCollection::const_iterator it =  ttac.begin();it !=  ttac.end(); ++it){
    const edm::Ref<std::vector<Trajectory> > traj_iterator = it->key;  
    // Trajectory Map, extract Trajectory for this track
    reco::TrackRef trackref = it->val;
    //tracks++;
    bool isBpixtrack = false, isFpixtrack = false;
    int nStripHits=0; int L1hits=0; int L2hits=0; int L3hits=0; int D1hits=0; int D2hits=0;
    std::vector<TrajectoryMeasurement> tmeasColl =traj_iterator->measurements();
    std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
    //loop on measurements to find out what kind of hits there are
    for(tmeasIt = tmeasColl.begin();tmeasIt!=tmeasColl.end();tmeasIt++){
      //if(! tmeasIt->updatedState().isValid()) continue; NOT NECESSARY (I HOPE)
      TransientTrackingRecHit::ConstRecHitPointer testhit = tmeasIt->recHit();
      if(testhit->geographicalId().det() != DetId::Tracker) continue; 
      uint testSubDetID = (testhit->geographicalId().subdetId()); 
      const DetId & hit_detId = testhit->geographicalId();
      if(testSubDetID==PixelSubdetector::PixelBarrel){
        isBpixtrack = true;
        int layer = PixelBarrelName(hit_detId).layerName();
        if(layer==1) L1hits++;
        if(layer==2) L2hits++;
        if(layer==3) L3hits++;
      }
      if(testSubDetID==PixelSubdetector::PixelEndcap){
        isFpixtrack = true;
        int disk = PixelEndcapName(hit_detId).diskName();
        if(disk==1) D1hits++;
        if(disk==2) D2hits++;
      }
      if(testSubDetID==StripSubdetector::TIB) nStripHits++;
      if(testSubDetID==StripSubdetector::TOB) nStripHits++;
      if(testSubDetID==StripSubdetector::TID) nStripHits++;
      if(testSubDetID==StripSubdetector::TEC) nStripHits++;
    }
    if(isBpixtrack || isFpixtrack){
      if(trackref->pt()<0.6 ||
         nStripHits<11 ||
         fabs(trackref->dxy(bestVtx->position()))>0.05 ||
         fabs(trackref->dz(bestVtx->position()))>0.5) continue;
    
      if(debug_){
        std::cout << "isBpixtrack : " << isBpixtrack << std::endl;
        std::cout << "isFpixtrack : " << isFpixtrack << std::endl;
      }
      //std::cout<<"This tracks has so many hits: "<<tmeasColl.size()<<std::endl;
      for(std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt!=tmeasColl.end(); tmeasIt++){   
        //if(! tmeasIt->updatedState().isValid()) continue; 
        
        TrajectoryStateOnSurface tsos = tsoscomb( tmeasIt->forwardPredictedState(), tmeasIt->backwardPredictedState() );
        TransientTrackingRecHit::ConstRecHitPointer hit = tmeasIt->recHit();
        if(hit->geographicalId().det() != DetId::Tracker )
          continue; 
        else {
          
//        //residual
          const DetId & hit_detId = hit->geographicalId();
          //uint IntRawDetID = (hit_detId.rawId());
          uint IntSubDetID = (hit_detId.subdetId());
          
          if(IntSubDetID == 0 ){
            if(debug_) std::cout << "NO IntSubDetID\n";
            continue;
          }
          if(IntSubDetID!=PixelSubdetector::PixelBarrel && IntSubDetID!=PixelSubdetector::PixelEndcap)
            continue;
          
          int disk=0; int layer=0; int panel=0; int module=0; bool isHalfModule=false;
          if(IntSubDetID==PixelSubdetector::PixelBarrel){ // it's a BPIX hit
            layer = PixelBarrelName(hit_detId).layerName();
            isHalfModule = PixelBarrelName(hit_detId).isHalfModule();
          }else if(IntSubDetID==PixelSubdetector::PixelEndcap){ // it's an FPIX hit
            disk = PixelEndcapName(hit_detId).diskName();
            panel = PixelEndcapName(hit_detId).pannelName();
            module = PixelEndcapName(hit_detId).plaquetteName();
          }
          if(layer==1){
            if(fabs(trackref->dxy(bestVtx->position()))>0.01 ||
               fabs(trackref->dz(bestVtx->position()))>0.1) continue;
            if(!(L2hits>0&&L3hits>0) && !(L2hits>0&&D1hits>0) && !(D1hits>0&&D2hits>0)) continue;
          }else if(layer==2){
            if(fabs(trackref->dxy(bestVtx->position()))>0.02 ||
               fabs(trackref->dz(bestVtx->position()))>0.1) continue;
            if(!(L1hits>0&&L3hits>0) && !(L1hits>0&&D1hits>0)) continue;
          }else if(layer==3){
            if(fabs(trackref->dxy(bestVtx->position()))>0.02 ||
               fabs(trackref->dz(bestVtx->position()))>0.1) continue;
            if(!(L1hits>0&&L2hits>0)) continue;
          }else if(disk==1){
            if(fabs(trackref->dxy(bestVtx->position()))>0.05 ||
               fabs(trackref->dz(bestVtx->position()))>0.5) continue;
            if(!(L1hits>0&&D2hits>0) && !(L2hits>0&&D2hits>0)) continue;
          }else if(disk==2){
            if(fabs(trackref->dxy(bestVtx->position()))>0.05 ||
               fabs(trackref->dz(bestVtx->position()))>0.5) continue;
            if(!(L1hits>0&&D1hits>0)) continue;
          }
          
              //check wether hit is valid or missing using track algo flag
          bool isHitValid   =hit->hit()->getType()==TrackingRecHit::valid;
          bool isHitMissing =hit->hit()->getType()==TrackingRecHit::missing;
          //std::cout<<"------ New Hit"<<std::endl;
          //std::cout<<(hit->hit()->getType()==TrackingRecHit::missing)<<std::endl;
          
          // get the enclosed persistent hit
          //const TrackingRecHit *persistentHit = hit->hit();
          // check if it's not null, and if it's a valid pixel hit
          //if ((persistentHit != 0) && (typeid(*persistentHit) == typeid(SiPixelRecHit))) {
          
            if(debug_) std::cout << "the hit is persistent\n";
            
            // tell the C++ compiler that the hit is a pixel hit
            //const SiPixelRecHit* pixhit = dynamic_cast<const SiPixelRecHit*>( hit->hit() );
         
            //define tracker and pixel geometry and topology
            const TrackerGeometry& theTracker(*theTrackerGeometry);
            const PixelGeomDetUnit* theGeomDet = dynamic_cast<const PixelGeomDetUnit*> (theTracker.idToDet(hit_detId) );
            //test if PixelGeomDetUnit exists
            if(theGeomDet == 0) {
              if(debug_) std::cout << "NO THEGEOMDET\n";
              continue;
            }
                      
              //const RectangularPixelTopology * topol = dynamic_cast<const RectangularPixelTopology*>(&(theGeomDet->specificTopology()));

              std::map<uint32_t, SiPixelHitEfficiencyModule*>::iterator pxd = theSiPixelStructure.find((*hit).geographicalId().rawId());

              // calculate alpha and beta from cluster position
              LocalTrajectoryParameters ltp = tsos.localParameters();
              //LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
              
              //float clust_alpha = atan2(localDir.z(), localDir.x());
              //float clust_beta = atan2(localDir.z(), localDir.y());
              
              
              
              // THE CUTS
              //int nrows = theGeomDet->specificTopology().nrows();
              //int ncols = theGeomDet->specificTopology().ncolumns();
              //
              //std::pair<float,float> pitchTest = theGeomDet->specificTopology().pitch();
              //RectangularPixelTopology rectTopolTest = RectangularPixelTopology(nrows, ncols, pitch.first, pitch.second);
              //std::pair<float,float> pixelTest = rectTopol.pixel(tsos.localPosition());
              //
              
              
              //*************** Edge cut ********************
               //double glx=tsos.globalPosition().x();
               //double gly=tsos.globalPosition().y();
               //double glz=tsos.globalPosition().z();
               double lx=tsos.localPosition().x();
               double ly=tsos.localPosition().y();
               //double lz=tsos.localPosition().z();
               //double lx_err=tsos.localError().positionError().xx();
               //double ly_err=tsos.localError().positionError().yy();
               //int telescope=0; int telescope_valid=0; 
               if(fabs(lx)>0.55 || fabs(ly)>3.0) continue;
               //LocalTrajectoryParameters predTrajParam=tsos.localParameters();
               //LocalVector dir=predTrajParam.momentum()/predTrajParam.momentum().mag();
               //double alpha=atan2(dir.z(), dir.x());
               //double beta=atan2(dir.z(), dir.y());
               bool passedFiducial=true;
               // Module fiducials:
               if(IntSubDetID==PixelSubdetector::PixelBarrel && fabs(ly)>=3.1) passedFiducial=false;
               if(IntSubDetID==PixelSubdetector::PixelEndcap &&
                  !((panel==1 &&
                    ((module==1 && fabs(ly)<0.7) ||
                     ((module==2 && fabs(ly)<1.1) &&
                      !(disk==-1 && ly>0.8 && lx>0.2) &&
                      !(disk==1 && ly<-0.7 && lx>0.2) &&
                      !(disk==2 && ly<-0.8)) ||
                     ((module==3 && fabs(ly)<1.5) &&
                      !(disk==-2 && lx>0.1 && ly>1.0) &&
                      !(disk==2 && lx>0.1 && ly<-1.0)) ||
                     ((module==4 && fabs(ly)<1.9) &&
                      !(disk==-2 && ly>1.5) &&
                      !(disk==2 && ly<-1.5)))) ||
                    (panel==2 &&
                    ((module==1 && fabs(ly)<0.7) ||
                     (module==2 && fabs(ly)<1.2 &&
                      !(disk>0 && ly>1.1) &&
                      !(disk<0 && ly<-1.1)) ||
                     (module==3 && fabs(ly)<1.6 &&
                      !(disk>0 && ly>1.5) &&
                      !(disk<0 && ly<-1.5)))))) passedFiducial=false;
               if(IntSubDetID==PixelSubdetector::PixelEndcap &&
                  ((panel==1 && (module==1 || (module>=3 && abs(disk)==1))) ||
                   (panel==2 && ((module==1 && abs(disk)==2) ||
                                 (module==3 && abs(disk)==1))))) passedFiducial=false;
               // ROC fiducials:
               double ly_mod = fabs(ly);
               if(IntSubDetID==PixelSubdetector::PixelEndcap && (panel+module)%2==1) ly_mod=ly_mod+0.405;
               float d_rocedge = fabs(fmod(ly_mod,0.81)-0.405);
               if(d_rocedge<=0.0625) passedFiducial=false;
               if(!( (IntSubDetID==PixelSubdetector::PixelBarrel &&
                      ((!isHalfModule && fabs(lx)<0.6) ||
                       (isHalfModule && lx>-0.3 && lx<0.2))) ||
                     (IntSubDetID==PixelSubdetector::PixelEndcap &&
                      ((panel==1 &&
                       ((module==1 && fabs(lx)<0.2) ||
                        (module==2 &&
                         ((fabs(lx)<0.55 && abs(disk)==1) ||
                          (lx>-0.5 && lx<0.2 && disk==-2) ||
                          (lx>-0.5 && lx<0.0 && disk==2))) ||
                        (module==3 && lx>-0.6 && lx<0.5) ||
                        (module==4 && lx>-0.3 && lx<0.15))) ||
                       (panel==2 &&
                        ((module==1 && fabs(lx)<0.6) ||
                         (module==2 &&
                          ((fabs(lx)<0.55 && abs(disk)==1) ||
                           (lx>-0.6 && lx<0.5 && abs(disk)==2))) ||
                         (module==3 && fabs(lx)<0.5))))))) passedFiducial=false;
               if(((IntSubDetID==PixelSubdetector::PixelBarrel && !isHalfModule) || 
                   (IntSubDetID==PixelSubdetector::PixelEndcap && !(panel==1 && (module==1 || module==4)))) &&
                   fabs(lx)<0.06) passedFiducial=false;
               
               
              //*************** find closest clusters ********************
              float dx_cl[2]; float dy_cl[2]; dx_cl[0]=dx_cl[1]=dy_cl[0]=dy_cl[1]=-9999.;
              ESHandle<PixelClusterParameterEstimator> cpEstimator;
              iSetup.get<TkPixelCPERecord>().get("PixelCPEGeneric", cpEstimator);
              if(cpEstimator.isValid()){
                const PixelClusterParameterEstimator &cpe(*cpEstimator);
                edm::ESHandle<TrackerGeometry> tracker;
                iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
                if(tracker.isValid()){
                  const TrackerGeometry *tkgeom=&(*tracker);
                  edm::Handle<edmNew::DetSetVector<SiPixelCluster> > clusterCollectionHandle;
                  iEvent.getByLabel("siPixelClusters", clusterCollectionHandle);
                  if(clusterCollectionHandle.isValid()){
                    const edmNew::DetSetVector<SiPixelCluster>& clusterCollection=*clusterCollectionHandle;
                    edmNew::DetSetVector<SiPixelCluster>::const_iterator itClusterSet=clusterCollection.begin();
                    float minD[2]; minD[0]=minD[1]=10000.;
                    for( ; itClusterSet!=clusterCollection.end(); itClusterSet++){
                      DetId detId(itClusterSet->id());
                      if(detId.rawId()!=hit->geographicalId().rawId()) continue;
                      //unsigned int sdId=detId.subdetId();
                      const PixelGeomDetUnit *pixdet=(const PixelGeomDetUnit*) tkgeom->idToDetUnit(detId);
                      edmNew::DetSet<SiPixelCluster>::const_iterator itCluster=itClusterSet->begin();
                      for( ; itCluster!=itClusterSet->end(); ++itCluster){
                        LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
                        PixelClusterParameterEstimator::LocalValues params=cpe.localParameters(*itCluster,*pixdet);
                        lp=params.first;
                        float D = sqrt((lp.x()-lx)*(lp.x()-lx)+(lp.y()-ly)*(lp.y()-ly));
                        if(D<minD[0]){
                          minD[1]=minD[0];
                          dx_cl[1]=dx_cl[0];
                          dy_cl[1]=dy_cl[0];
                          minD[0]=D;
                          dx_cl[0]=lp.x();
                          dy_cl[0]=lp.y();
                        }else if(D<minD[1]){
                          minD[1]=D;
                          dx_cl[1]=lp.x();
                          dy_cl[1]=lp.y();
                        }
                      }  // loop on clusterSets 
                    } // loop on clusterCollection
                    for(size_t i=0; i<2; i++){
                      if(minD[i]<9999.){
                        dx_cl[i]=fabs(dx_cl[i]-lx);
                        dy_cl[i]=fabs(dy_cl[i]-ly);
                      }
                    }
                  } // valid clusterCollectionHandle
                } // valid tracker
              } // valid cpEstimator
              // distance of hit from closest cluster!
              float d_cl[2]; d_cl[0]=d_cl[1]=-9999.;
              if(dx_cl[0]!=-9999. && dy_cl[0]!=-9999.) d_cl[0]=sqrt(dx_cl[0]*dx_cl[0]+dy_cl[0]*dy_cl[0]);
              if(dx_cl[1]!=-9999. && dy_cl[1]!=-9999.) d_cl[1]=sqrt(dx_cl[1]*dx_cl[1]+dy_cl[1]*dy_cl[1]);
              if(isHitMissing && (d_cl[0]<0.05 || d_cl[1]<0.05)){ isHitMissing=0; isHitValid=1; }
              
              
              if(debug_){
                std::cout << "Ready to add hit in histogram:\n";
                //std::cout << "detid: "<<hit_detId<<std::endl;
                std::cout << "isHitValid: "<<isHitValid<<std::endl;
                std::cout << "isHitMissing: "<<isHitMissing<<std::endl;
                //std::cout << "passedEdgeCut: "<<passedFiducial<<std::endl;            
              }
              
              
              if(pxd!=theSiPixelStructure.end() && isHitValid && passedFiducial)
                ++nvalid;
              if(pxd!=theSiPixelStructure.end() && isHitMissing && passedFiducial)
                ++nmissing;
                
              if (pxd!=theSiPixelStructure.end() && passedFiducial && (isHitValid || isHitMissing))
                (*pxd).second->fill(ltp, isHitValid, modOn, ladOn, layOn, phiOn, bladeOn, diskOn, ringOn);      

          //}//end if (persistent hit exists and is pixel hit)
          
        }//end of else 
        
        
      }//end for (all traj measurements of pixeltrack)
    }//end if (is pixeltrack)
    else
      if(debug_) std::cout << "no pixeltrack:\n";
    
  }//end loop on map entries
}
void SiPixelHitEfficiencySource::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file SiPixelHitEfficiencySource.cc.

References firstRun.

                                          {
  LogInfo("PixelDQM") << "SiPixelHitEfficiencySource beginJob()" << endl;
  firstRun = true;
}
void SiPixelHitEfficiencySource::beginRun ( const edm::Run r,
edm::EventSetup const &  iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 104 of file SiPixelHitEfficiencySource.cc.

References bladeOn, debug_, diskOn, Exception, firstRun, edm::EventSetup::get(), ladOn, layOn, modOn, python::rootplot::argparse::module, nmissing, nvalid, phiOn, pSet_, ringOn, SiPixelFolderOrganizer::setModuleFolder(), and theSiPixelStructure.

                                                                                      {
  LogInfo("PixelDQM") << "SiPixelHitEfficiencySource beginRun()" << endl;
  
  if(firstRun){
  // retrieve TrackerGeometry for pixel dets
  edm::ESHandle<TrackerGeometry> TG;
  iSetup.get<TrackerDigiGeometryRecord>().get(TG);
  if (debug_) LogVerbatim("PixelDQM") << "TrackerGeometry "<< &(*TG) <<" size is "<< TG->dets().size() << endl;
 
  // build theSiPixelStructure with the pixel barrel and endcap dets from TrackerGeometry
  for (TrackerGeometry::DetContainer::const_iterator pxb = TG->detsPXB().begin();  
       pxb!=TG->detsPXB().end(); pxb++) {
    if (dynamic_cast<PixelGeomDetUnit*>((*pxb))!=0) {
      SiPixelHitEfficiencyModule* module = new SiPixelHitEfficiencyModule((*pxb)->geographicalId().rawId());
      theSiPixelStructure.insert(pair<uint32_t, SiPixelHitEfficiencyModule*>((*pxb)->geographicalId().rawId(), module));
    }
  }
  for (TrackerGeometry::DetContainer::const_iterator pxf = TG->detsPXF().begin(); 
       pxf!=TG->detsPXF().end(); pxf++) {
    if (dynamic_cast<PixelGeomDetUnit*>((*pxf))!=0) {
      SiPixelHitEfficiencyModule* module = new SiPixelHitEfficiencyModule((*pxf)->geographicalId().rawId());
      theSiPixelStructure.insert(pair<uint32_t, SiPixelHitEfficiencyModule*>((*pxf)->geographicalId().rawId(), module));
    }
  }
  LogInfo("PixelDQM") << "SiPixelStructure size is " << theSiPixelStructure.size() << endl;

  // book residual histograms in theSiPixelFolder - one (x,y) pair of histograms per det
  SiPixelFolderOrganizer theSiPixelFolder;
  for (std::map<uint32_t, SiPixelHitEfficiencyModule*>::iterator pxd = theSiPixelStructure.begin(); 
       pxd!=theSiPixelStructure.end(); pxd++) {

    if(modOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first)) (*pxd).second->book(pSet_);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Folder Creation Failed! "; 
    }
    if(ladOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first,1)) (*pxd).second->book(pSet_,1);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource ladder Folder Creation Failed! "; 
    }
    if(layOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first,2)) (*pxd).second->book(pSet_,2);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource layer Folder Creation Failed! "; 
    }
    if(phiOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first,3)) (*pxd).second->book(pSet_,3);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource phi Folder Creation Failed! "; 
    }
    if(bladeOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first,4)) (*pxd).second->book(pSet_,4);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Blade Folder Creation Failed! "; 
    }
    if(diskOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first,5)) (*pxd).second->book(pSet_,5);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Disk Folder Creation Failed! "; 
    }
    if(ringOn){
      if (theSiPixelFolder.setModuleFolder((*pxd).first,6)) (*pxd).second->book(pSet_,6);
      else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Ring Folder Creation Failed! "; 
    }
  }
  
  nvalid=0;
  nmissing=0;
  
  firstRun = false;
  }
}
void SiPixelHitEfficiencySource::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 173 of file SiPixelHitEfficiencySource.cc.

References dbe_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), download_sqlite_cfg::outputFile, pSet_, DQMStore::save(), and AlCaHLTBitMon_QueryRunRegistry::string.

                                            {
  LogInfo("PixelDQM") << "SiPixelHitEfficiencySource endJob()";

  // save the residual histograms to an output root file
  bool saveFile = pSet_.getUntrackedParameter<bool>("saveFile", true);
  if (saveFile) { 
    std::string outputFile = pSet_.getParameter<std::string>("outputFile");
    LogInfo("PixelDQM") << " - saving histograms to "<< outputFile.data();
    dbe_->save(outputFile);
  } 
  LogInfo("PixelDQM") << endl; // dbe_->showDirStructure();
  
  //std::cout<< "********** SUMMARY **********"<<std::endl;
  //std::cout<< "number of valid hits: "<<nvalid<<std::endl;
  //std::cout<< "number of missing hits: "<<nmissing<<std::endl;
}

Member Data Documentation

Definition at line 55 of file SiPixelHitEfficiencySource.h.

Referenced by SiPixelHitEfficiencySource().

Definition at line 65 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 58 of file SiPixelHitEfficiencySource.h.

Referenced by endJob(), and SiPixelHitEfficiencySource().

Definition at line 60 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 65 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 67 of file SiPixelHitEfficiencySource.h.

Referenced by beginJob(), and beginRun().

Definition at line 63 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 63 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 61 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 71 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), and beginRun().

Definition at line 56 of file SiPixelHitEfficiencySource.h.

Referenced by SiPixelHitEfficiencySource().

Definition at line 71 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), and beginRun().

Definition at line 73 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 63 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 51 of file SiPixelHitEfficiencySource.h.

Referenced by beginRun(), endJob(), and SiPixelHitEfficiencySource().

Definition at line 65 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), beginRun(), and SiPixelHitEfficiencySource().

Definition at line 52 of file SiPixelHitEfficiencySource.h.

Definition at line 69 of file SiPixelHitEfficiencySource.h.

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

Definition at line 53 of file SiPixelHitEfficiencySource.h.

Referenced by analyze(), and SiPixelHitEfficiencySource().

Definition at line 80 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 75 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 79 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 74 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 76 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 77 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().

Definition at line 78 of file SiPixelHitEfficiencySource.h.

Referenced by analyze().