CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
Utilities.cc File Reference
#include "L1Trigger/L1TMuonEndCap/interface/Utilities.h"
#include "TRandom3.h"
#include "TStopwatch.h"
#include "TTree.h"
#include "TNtuple.h"
#include "TFile.h"
#include "TChain.h"
#include "TMath.h"

Go to the source code of this file.

Functions

void mergeNtuples (const char *ntuplename, const char *filestomerge, const char *outputfile)
 
float processPrediction (float BDTPt, int Quality, float PrelimFit)
 
void sortNtupleByEvent (const char *ntuplename, const char *filenametosort, const char *outputfile)
 

Variables

const Double_t ptscale [31]
 
const std::vector< Double_t > ptScale = std::vector<Double_t>(ptscale, ptscale + sizeof ptscale / sizeof ptscale[0])
 
const Double_t twoJets_scale [16]
 
const std::vector< Double_t > twoJetsScale = std::vector<Double_t>(twoJets_scale, twoJets_scale + sizeof twoJets_scale / sizeof twoJets_scale[0])
 

Function Documentation

void mergeNtuples ( const char *  ntuplename,
const char *  filestomerge,
const char *  outputfile 
)

Definition at line 87 of file Utilities.cc.

88 {
89  TChain chain(ntuplename);
90  chain.Add(filestomerge);
91  chain.Merge(outputfile);
92 }
float processPrediction ( float  BDTPt,
int  Quality,
float  PrelimFit 
)

Definition at line 47 of file Utilities.cc.

References RPCpg::pts, and ptscale.

48 {
49 // Discretize and scale the BDTPt prediction
50 
51 
52  // Fix terrible predictions
53  if(BDTPt < 0) BDTPt = PrelimFit;
54  if(BDTPt > 250) BDTPt = PrelimFit;
55 
56  float BDTPt1 = BDTPt;
57  float scaleF = 1.0;
58 
59  // Scale based upon quality
60  if (Quality == 3) scaleF = 1.15;
61  if (Quality == 2) scaleF = 1.3;
62  if (Quality == 1) scaleF = 1.7;
63 
64  BDTPt1 = scaleF*BDTPt1;
65 
66 
67  // Discretize based upon ptscale
68  for (int pts=0; pts<31; pts++)
69  {
70  if (ptscale[pts]<=BDTPt1 && ptscale[pts+1]>BDTPt1)
71  {
72  BDTPt1 = ptscale[pts];
73  break;
74  }
75  }
76 
77  if (BDTPt1 > 140) BDTPt1 = 140;
78  if (BDTPt1 < 0) BDTPt1 = 0;
79 
80  return BDTPt1;
81 }
const Double_t ptscale[31]
Definition: Utilities.cc:26
static const double pts[33]
Definition: Constants.h:30
void sortNtupleByEvent ( const char *  ntuplename,
const char *  filenametosort,
const char *  outputfile 
)

Definition at line 98 of file Utilities.cc.

References f, validate-o2o-wbm::f2, i, cmsHarvester::index, and MainPageGenerator::tree.

99 {
100  //TFile f("../../all_test_redux_post.root");
101  TFile f(filenametosort);
102  TNtuple *tree = (TNtuple*)f.Get(ntuplename);
103  Int_t nentries = (Int_t)tree->GetEntries();
104  //Drawing variable pz with no graphics option.
105  //variable pz stored in array fV1 (see TTree::Draw)
106  tree->Draw("Event","","goff");
107  Int_t *index = new Int_t[nentries];
108  //sort array containing pz in decreasing order
109  //The array index contains the entry numbers in decreasing order
110  TMath::Sort(nentries,tree->GetV1(),index);
111 
112  //open new file to store the sorted Tree
113  //TFile f2("../../test_events_sorted.root","recreate");
114  TFile f2(outputfile,"recreate");
115 
116  //Create an empty clone of the original tree
117  TTree *tsorted = (TTree*)tree->CloneTree(0);
118  for (Int_t i=0;i<nentries;i++) {
119  tree->GetEntry(index[i]);
120  tsorted->Fill();
121  }
122  tsorted->Write();
123  delete [] index;
124 }
int i
Definition: DBlmapReader.cc:9
double f[11][100]

Variable Documentation

const Double_t ptscale[31]
Initial value:
= { 0,
1.5, 2.0, 2.5, 3.0, 3.5, 4.0,
4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 12.0, 14.0,
16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0, 45.0,
50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 140.0 }

Definition at line 26 of file Utilities.cc.

Referenced by L1TGMT::bookHistograms(), and processPrediction().

const std::vector<Double_t> ptScale = std::vector<Double_t>(ptscale, ptscale + sizeof ptscale / sizeof ptscale[0])

Definition at line 32 of file Utilities.cc.

Referenced by CSCTFPtLUT::CSCTFPtLUT(), and CSCTFTrackProducer::produce().

const Double_t twoJets_scale[16]
Initial value:
= { 0,
0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 20.0, 50.0,
100, 500, 1000, 5000, 7500, 50000}

Definition at line 35 of file Utilities.cc.

const std::vector<Double_t> twoJetsScale = std::vector<Double_t>(twoJets_scale, twoJets_scale + sizeof twoJets_scale / sizeof twoJets_scale[0])

Definition at line 39 of file Utilities.cc.