ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/applySelection.cc
(Generate patch)

Comparing UserCode/MitHzz4l/Selection/src/applySelection.cc (file contents):
Revision 1.24 by khahn, Mon May 21 22:29:53 2012 UTC vs.
Revision 1.26 by khahn, Wed May 23 13:33:15 2012 UTC

# Line 97 | Line 97 | vector<bool>   PFnoPUflag;;
97   //
98   // prototypes
99   //----------------------------------------------------------------------------
100 bool setPV(ControlFlags,const mithep::Array<mithep::Vertex>*, mithep::Vertex& );
100   void initPUWeights();
101   double getPUWeight(unsigned npu);
102   void setEffiencyWeights(EventData&, WeightStruct& );
# Line 105 | Line 104 | void initRunLumiRangeMap();
104   void initEvtRhoMap(map<unsigned,float> &);
105   unsigned makePFnoPUArray(mithep::Array<PFCandidate> * fPFCandidates,
106                           vector<bool> &pfNoPileUpFlag,
107 <                         mithep::Array<Vertex>      * vtxArr );
107 >                         const mithep::VertexCol     * vtxArr );
108   //----------------------------------------------------------------------------
109  
110  
# Line 117 | Line 116 | int main(int argc, char** argv)
116   {
117    cutstrs.push_back(string("skim0"));              //0
118    cutstrs.push_back(string("skim1"));              //1
119 +  cutstrs.push_back(string("skim2"));              //1
120    cutstrs.push_back(string("trigger"));            //2
121    // -------------------------------------------------
122    cutstrs.push_back(string("Z candidate"));        //3
# Line 128 | Line 128 | int main(int argc, char** argv)
128    cutstrs.push_back(string("ZZ 20/10"));           //8
129    cutstrs.push_back(string("resonance"));          //9
130    cutstrs.push_back(string("m4l>70"));             //10
131 <  cutstrs.push_back(string("m4l>100"));            //11
131 >  cutstrs.push_back(string("m4l>100, mZ2 > 12"));                  //11
132  
133  
134  
# Line 268 | Line 268 | int main(int argc, char** argv)
268    //  mithep::TGenInfo    *ginfo  = new mithep::TGenInfo();
269    mithep::Array<mithep::Electron>             *electronArr   = new mithep::Array<mithep::Electron>();
270    mithep::Array<mithep::Muon>                 *muonArr       = new mithep::Array<mithep::Muon>();
271 <  mithep::Array<mithep::Vertex>               *vtxArr        = new mithep::Array<mithep::Vertex>();
271 >  const mithep::VertexCol              *vtxArr        = 0;//new mithep::Array<mithep::Vertex>();
272    mithep::Array<mithep::PFCandidate>          *pfArr         = new mithep::Array<mithep::PFCandidate>();
273    mithep::Array<mithep::PileupInfo>           *puArr         = new mithep::Array<mithep::PileupInfo>();
274    mithep::Array<mithep::PileupEnergyDensity>  *puDArr        = new mithep::Array<mithep::PileupEnergyDensity>();
# Line 365 | Line 365 | int main(int argc, char** argv)
365        */
366  
367        if(!(ientry%1000)) cerr << "entry: " << ientry << endl;
368      setPV( ctrl, vtxArr, vtx);
368        //if (!(setPV( ctrl, vtxArr, vtx)) ) continue;
369  
370        float rho = evtrhoMap[info->EvtNum()];
# Line 385 | Line 384 | int main(int argc, char** argv)
384          //
385          // xsec & PU weights
386          //
387 <        weights.w = getWeight(xstab,entrymap,chain)/ctrl.totalMC;
387 >        weights.w = 1;//getWeight(xstab,entrymap,chain)/ctrl.totalMC;
388          cout << "xsec weight: " << weights.w << endl;
389          int npu = -1;
390          for(int i=0;i<puArr->GetEntries();i++) {
# Line 453 | Line 452 | int main(int argc, char** argv)
452  
453          // reference
454          apply_HZZ4L_reference2_selection(ctrl, info,
455 <                                         vtx,
455 >                                         vtxArr,
456                                           pfArr,
457   #ifdef HACKED_RHOS
458                                           rho,
# Line 462 | Line 461 | int main(int argc, char** argv)
461   #endif
462                                           electronArr,
463                                           &electronReferencePreSelection,
464 <                                         &electronReferenceIDMVASelection,
464 >                                         &electronReferenceIDMVASelectionV1,
465                                           &electronReferenceIsoSelection,
466                                           muonArr,
467                                           &muonReferencePreSelection,
# Line 583 | Line 582 | int main(int argc, char** argv)
582  
583   }
584  
586 //----------------------------------------------------------------------------
587 //
588 // Get primary vertices
589 // Assumes primary vertices are ordered by sum-pT^2 (as should be in CMSSW)
590 // NOTE: if no PV is found from fitting tracks, the beamspot is used
591 //
592 //----------------------------------------------------------------------------
593 bool setPV(ControlFlags ctrl,
594           const mithep::Array<mithep::Vertex> * vtxArr,
595           mithep::Vertex & vtx)
596 //----------------------------------------------------------------------------
597 {
598  const Vertex *bestPV = 0;
599  float best_sumpt=-1;
600
601  // good PV requirements
602  const UInt_t   fMinNTracksFit = 0;
603  const Double_t fMinNdof       = 4;
604  const Double_t fMaxAbsZ       = 24;
605  const Double_t fMaxRho        = 2;
606  
607  for(int i=0; i<vtxArr->GetEntries(); ++i) {
608    const Vertex *pv = (Vertex*)(vtxArr->At(i));
609    if( ctrl.debug ) cout << "vertex :: " << i << "\tntrks: " << pv->NTracks() << endl;
610    
611    // Select best PV for corrected d0; if no PV passing cuts, the first PV in the collection will be used
612    if(!pv->IsValid())                                continue;
613    if(pv->NTracksFit()       < fMinNTracksFit)       continue;
614    if(pv->Ndof()                 < fMinNdof)         continue;
615    if(fabs(pv->Z()) > fMaxAbsZ)                      continue;
616    if(pv->Position().Rho()   > fMaxRho)              continue;    
617    
618    // take the first ...
619    bestPV = pv;
620    break;
621
622    // this never reached ...    
623    float tmp_sumpt=0;
624    for( int t=0; t<pv->NTracks(); t++ )
625      tmp_sumpt += pv->Trk(t)->Pt();
626    
627    if( tmp_sumpt > best_sumpt  ) {
628      bestPV = pv;
629      best_sumpt = tmp_sumpt;
630      if( ctrl.debug) cout << "new PV set, pt : " << best_sumpt << endl;
631    }
632  }
633  // sync
634  if(!bestPV) bestPV = vtxArr->At(0);
635  //if(!bestPV) return false;
636  vtx.SetPosition(bestPV->X(),bestPV->Y(),bestPV->Z());
637  vtx.SetErrors(bestPV->XErr(),bestPV->YErr(),bestPV->ZErr());
638  return true;
639 };
640
585  
586  
587   //----------------------------------------------------------------------------
# Line 730 | Line 674 | void initEvtRhoMap( map<unsigned, float>
674    cout << "initialzing EvtRhoMap ";
675    //FILE * f = fopen("evtrho.dat", "r");
676    //  FILE * f = fopen("allrho.cali.uniq.dat", "r");
677 <  FILE * f = fopen("allrhoAA.cali.uniq.dat", "r");
677 >  FILE * f = fopen("/data/blue/khahn/CMSSW_4_4_2/src/MitHzz4l/allrhoAA.cali.uniq.dat", "r");
678    int lcount=0;
679    while( fscanf( f, "%u:%f", &evt, &rho ) ) {
680      if( feof(f) ) break;
# Line 744 | Line 688 | void initEvtRhoMap( map<unsigned, float>
688   //----------------------------------------------------------------------------
689   unsigned makePFnoPUArray(mithep::Array<PFCandidate> * fPFCandidates,
690                       vector<bool> &pfNoPileUpflag,
691 <                     mithep::Array<Vertex>      * vtxArr )
691 >                     const mithep::VertexCol      * vtxArr )
692   //----------------------------------------------------------------------------
693   {
694    for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines