ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetIDMod.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/JetIDMod.cc (file contents):
Revision 1.4 by loizides, Thu Nov 27 16:30:27 2008 UTC vs.
Revision 1.5 by loizides, Fri Nov 28 09:13:50 2008 UTC

# Line 9 | Line 9 | using namespace mithep;
9   ClassImp(mithep::JetIDMod)
10  
11   //--------------------------------------------------------------------------------------------------
12 <  JetIDMod::JetIDMod(const char *name, const char *title) :
12 > JetIDMod::JetIDMod(const char *name, const char *title) :
13    BaseMod(name,title),
14 <  fPrintDebug(false),
15 <  fJetName(Names::gkCaloJetBrn),
14 >  fJetBranchName(Names::gkCaloJetBrn),
15    fGoodJetsName(ModNames::gkGoodJetsName),  
16 <  fJetIDType("HWWJets"),
17 <  fJets(0),
18 <  fNEventsProcessed(0),
20 <  fUseJetCorrection(false),
21 <  fJetEtCut(15.0)
16 >  fUseJetCorrection(kFALSE),
17 >  fJetEtCut(15.0),
18 >  fJets(0)
19   {
20    // Constructor.
21   }
22  
23   //--------------------------------------------------------------------------------------------------
27 void JetIDMod::Begin()
28 {
29  // Run startup code on the client machine. For this module, we dont do
30  // anything here.
31 }
32
33 //--------------------------------------------------------------------------------------------------
24   void JetIDMod::Process()
25   {
26    // Process entries of the tree.
27  
28 <  fNEventsProcessed++;
29 <
30 <  if (fNEventsProcessed % 1000000 == 0 || fPrintDebug) {
31 <    time_t systime;
42 <    systime = time(NULL);
43 <
44 <    cerr << endl << "JetIDMod : Process Event " << fNEventsProcessed << "  Time: " << ctime(&systime) << endl;  
45 <  }  
46 <
47 <  //Get Jets
48 <  LoadBranch(fJetName);
49 <  ObjArray<Jet> *GoodJets = new ObjArray<Jet>;
28 >  LoadBranch(fJetBranchName);
29 >
30 >  JetOArr *GoodJets = new JetOArr;
31 >  GoodJets->SetName(fGoodJetsName);
32  
33 +  // loop over jets
34    for (UInt_t i=0; i<fJets->GetEntries(); ++i) {
35 <    Jet *jet = fJets->At(i);
36 <    
37 <    const int nCuts = 3;
38 <    bool passCut[nCuts] = {false, false, false};
35 >    const Jet *jet = fJets->At(i);
36 >
37 >    if (jet->AbsEta() > 5.0)
38 >      continue;
39      
40 <    if(fUseJetCorrection == false) {
41 <      if(jet->Et() > fJetEtCut)             passCut[0] = true;
42 <      if(fabs(jet->Eta()) < 5.0)            passCut[1] = true;        
43 <      if(jet->Alpha() > 0.2 ||
44 <         jet->Et() > 20.)
45 <        passCut[2] = true;
63 <    } else {
64 <      if(jet->Et()*
65 <         jet->L2RelativeCorrectionScale()*
66 <         jet->L3AbsoluteCorrectionScale() > fJetEtCut)            passCut[0] = true;
67 <      if(fabs(jet->Eta()) < 5.0)                                  passCut[1] = true;  
68 <                                                                  passCut[2] = true;
69 <    }
40 >    Double_t jetet = jet->Et();
41 >    if (fUseJetCorrection)
42 >      jetet *= jet->L2RelativeCorrectionScale() * jet->L3AbsoluteCorrectionScale();
43 >
44 >    if (jetet > fJetEtCut)
45 >      continue;
46      
47 <    // Final decision
48 <    bool passAllCuts = true;
49 <    for(int i=0; i<nCuts; i++) {
74 <      passAllCuts = passAllCuts && passCut[i];
75 <    }
76 <                    
77 <    //Save Good Jets
78 <    if (passAllCuts)
79 <      GoodJets->Add(jet);            
80 <   }
81 <
82 <  //Final Summary Debug Output  
83 <  if ( fPrintDebug ) {
84 <    cerr << "Event Dump: " << fNEventsProcessed << endl;  
85 <    cerr << "Central Jets" << endl;
86 <    for (UInt_t i = 0; i < GoodJets->GetEntries(); i++) {
87 <      cerr << i << " " << GoodJets->At(i)->Pt() << " "
88 <           << GoodJets->At(i)->Eta() << " " << GoodJets->At(i)->Phi() << endl;    
89 <    }
90 <  }  
47 >    // add good jet to collection
48 >    GoodJets->Add(jet);            
49 >  }
50    
51 <  //Save Objects for Other Modules to use
52 <  AddObjThisEvt(GoodJets, fGoodJetsName.Data());  
51 >  // add to event for other modules to use
52 >  AddObjThisEvt(GoodJets);  
53   }
54  
55   //--------------------------------------------------------------------------------------------------
56   void JetIDMod::SlaveBegin()
57   {
58    // Run startup code on the computer (slave) doing the actual analysis. Here,
59 <  // we typically initialize histograms and other analysis objects and request
101 <  // branches. For this module, we request a branch of the MitTree.
59 >  // we just request the jet collection branch.
60  
61 <  ReqBranch(fJetName,              fJets);
104 < }
105 <
106 < //--------------------------------------------------------------------------------------------------
107 < void JetIDMod::SlaveTerminate()
108 < {
109 <  // Run finishing code on the computer (slave) that did the analysis. For this
110 <  // module, we dont do anything here.
111 <
112 < }
113 <
114 < //--------------------------------------------------------------------------------------------------
115 < void JetIDMod::Terminate()
116 < {
117 <  // Run finishing code on the client computer. For this module, we dont do
118 <  // anything here.
61 >  ReqBranch(fJetBranchName, fJets);
62   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines