ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/PVStudy/plugins/PVStudy.cc
(Generate patch)

Comparing UserCode/Jeng/PVStudy/plugins/PVStudy.cc (file contents):
Revision 1.17 by yygao, Tue Jan 26 12:06:49 2010 UTC vs.
Revision 1.18 by jengbou, Fri Jan 29 21:36:22 2010 UTC

# Line 51 | Line 51 | Implementation:
51   #include <SimDataFormats/Track/interface/SimTrackContainer.h>
52   // BeamSpot
53   #include "DataFormats/BeamSpot/interface/BeamSpot.h"
54 // Trigger
55 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
56 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
57 #include "CondFormats/L1TObjects/interface/L1GtPrescaleFactors.h"
58 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsAlgoTrigRcd.h"
59 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsTechTrigRcd.h"
60 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
61 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
62 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
63 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskVetoAlgoTrigRcd.h"
64 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskVetoTechTrigRcd.h"
65 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
66 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
67 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
54  
55  
56   //root
# Line 101 | Line 87 | PVStudy::PVStudy(const edm::ParameterSet
87    nTrkMax_                   = iConfig.getUntrackedParameter<int>("nTrkMax");
88    zsigncut_                  = iConfig.getUntrackedParameter<int>("zsigncut");
89    bsSrc = iConfig.getParameter< edm::InputTag >("beamSpot");
90 <  applyEvtClean_            = iConfig.getUntrackedParameter<bool>("applyEvtClean",false);
90 > //   applyEvtClean_             = iConfig.getUntrackedParameter<bool>("applyEvtClean",false);
91    histoFileName_             = iConfig.getUntrackedParameter<std::string> ("histoFileName");
92    
93    //now do what ever initialization is needed
94    pvinfo.clear();
95  
110
96    // Specify the data mode vector
97    if(realData_) datamode.push_back(0);
98    else {
# Line 669 | Line 654 | PVStudy::analyze(const edm::Event& iEven
654    //=======================================================
655    // Apply event cleaning for firstcoll data and MC
656    //=======================================================
672  if(applyEvtClean_) {
673    // =====Select on the trigger bits
674    edm::ESHandle<L1GtTriggerMenu> menuRcd;
675    iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd) ;
676    const L1GtTriggerMenu* menu = menuRcd.product();
677    edm::Handle< L1GlobalTriggerReadoutRecord > gtRecord;
678    iEvent.getByLabel( edm::InputTag("gtDigis"), gtRecord);
679    
680    bool isTechBit0 = false;
681    bool isTechBit40 = false;
682    bool isBeamHalo = false;
683
684    TechnicalTriggerWord tw = gtRecord->technicalTriggerWord();
685    if ( ! tw.empty() ) {
686      // loop over dec. bit to get total rate (no overlap)
687      for ( int i = 0; i < 64; ++i ) {
688        if ( tw[i] ) {
689          //cout<<"technical number "<<i<<"  "<<endl;
690          if (i == 0) isTechBit0  = true;
691          if (i < 40 && i > 35) isBeamHalo = true;   // The beamHalo bits are 36-39
692          if (i == 40 || i == 41) isTechBit40 = true;
693        }
694      }
695    } // =====End select on the trigger bits
696    // =====Loop over the trackColl to tet the fraction of HighPurity tracks
697    int nTracks = 0;
698    int nHighPurityTracks=0;
699    double fHighPurity=0;
700
701    for (unsigned int i=0; i<trackCollectionHandle->size(); i++, nTracks++) {
702      TrackRef tkref(trackCollectionHandle,i);
703      if( (tkref->qualityMask() & 4 ) == 4) ++nHighPurityTracks;
704    }
705    if(nTracks>0)
706      fHighPurity =  double(nHighPurityTracks)/double(nTracks);
707    if(verbose_)
708      cout<<"fraction of HighPurity track is "<<fHighPurity<<endl;  
709    
710    // Apply the event selection for MC events
711    if(realData_) {
712      if(!isTechBit40 || isBeamHalo || (fHighPurity<0.2&&nTracks>10) || vertexColl->begin()->isFake()) {
713        glob_runno_ = iEvent.id().run();
714        glob_evtno_ = iEvent.id().event();
715        glob_ls_   = iEvent.luminosityBlock();
716        glob_bx_  = iEvent.bunchCrossing();  
717        return;
718      }
719      else {
720        // TechBit 0, beamHalo are not simulted in MC
721        if ( !isTechBit0 || !isTechBit40 || isBeamHalo || (fHighPurity<0.2&&nTracks>10) || vertexColl->begin()->isFake()) return;
722      }
723    }
724  } // End of Apply event cleaning cuts for firstcoll data
725
657  
658 +  // =====Loop over the trackColl to tet the fraction of HighPurity tracks
659 +  int nTracks = 0;
660 +  int nHighPurityTracks=0;
661 +  double fHighPurity=0;
662 +
663 +  for (unsigned int i=0; i<trackCollectionHandle->size(); i++, nTracks++) {
664 +    TrackRef tkref(trackCollectionHandle,i);
665 +    if(tkref->quality(reco::TrackBase::highPurity)) ++nHighPurityTracks;
666 +  }
667 +  if(nTracks>0)
668 +    fHighPurity =  double(nHighPurityTracks)/double(nTracks);
669 +  if(verbose_)
670 +    cout<<"fraction of HighPurity track is "<<fHighPurity<<endl;  
671 +    
672 +  if( (fHighPurity<0.2 && nTracks>10) || vertexColl->begin()->isFake()) {
673 +    //  glob_runno_ = iEvent.id().run();
674 +    //  glob_evtno_ = iEvent.id().event();
675 +    //  glob_ls_   = iEvent.luminosityBlock();
676 +    //  glob_bx_  = iEvent.bunchCrossing();  
677 +    return;
678 +  }
679  
680    //=======================================================
681    // Fill trackparameters of the input tracks to pvtx fitter

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines