Kalanand's April 2009 Log

   March 2009   
April 2009
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
2627282930  
   May 2009   

April 6th

Find the leading and second jet indices given the unsorted pt of all jets in the event

Here is the code to do this
void FindLeadIndex(float pT[], int &lead, int &sec) {

  float max = 0.0;
  lead = -1;
  for (int i=0; i<10; i++) {
    if(pT[i]>max) { max = pT[i]; lead = i; }
  }

  max = 0.0;
  sec = -1;
  for (int i=0; i<10; i++) {
    if(i==lead) continue;
    if(pT[i]>max) { max = pT[i]; sec = i; }
  }
}

April 7th

A variation of the above

Now let's suppose we need to find the leading and second jet indices but after excluding any electrons in the jet collection. In the Z+jets events there are two identified electrons. We remove these electrons from the jet collection by performing deltaR matching.
void FindLeadIndex(float pT[], float eta[], float phi[], float e1eta, float e1phi, float e2eta, float e2phi, int &lead, int &sec) {

  float max = 0.0;
  lead = -1;
  for (int i=0; i<10; i++) {
    
    double r1 = radius( eta[i],phi[i], e1eta, e1phi );
    double r2 = radius( eta[i],phi[i], e2eta, e2phi );
    if(!(r1>0.2 && r2>0.2) ) continue;
    if(pT[i]>max) { max = pT[i]; lead = i; }
  }

  max = 0.0;
  sec = -1;
  for (int i=0; i<10; i++) {
    if(i==lead) continue;
    double r1 = radius( eta[i],phi[i], e1eta, e1phi );
    double r2 = radius( eta[i],phi[i], e2eta, e2phi );
    if(!(r1>0.2 && r2>0.2) ) continue;
    if(pT[i]>max) { max = pT[i]; sec = i; }
  }
}

April 22nd

Copy data events from a remote site where I have no direct access

I can still run CRAB job on that site and essentially dump the whole event as output of my job without doing any processing of data.
Here is a sample script.
[CRAB]

jobtype = cmssw
scheduler = glite


[CMSSW]

### The data you want to access (to be found on DBS) 
datasetpath=/QCD_Pt30/exotica-EXODiPhoSkimOct09_7TeV-676e44618905b4813b74b51f84e07bf5/USER
dbs_url   = https://cmsdbsprod.cern.ch:8443/cms_dbs_ph_analysis_02_writer/servlet/DBSServlet


### The ParameterSet you want to use
pset = copyData_crab_template_cfg.py




### Splitting parameters
total_number_of_events=-1
#events_per_job = 25000
number_of_jobs = 4



### The output files (comma separated list)
output_file = exotica-EXODiPhoSkimOct09_7TeV.root

[USER]




### OUTPUT files Management
##  output back into UI 
return_data = 0




### OUTPUT files INTO A SE
copy_data = 1
storage_element = cmssrm.fnal.gov
storage_path = /srm/managerv2?SFN=/resilient
user_remote_dir = /kalanand/junk

[GRID]

## RB/WMS management:
rb = CERN


## CMS myproxy server, to proxy delegation
proxy_server = myproxy.cern.ch

Go to March's log


Last modified: Wed Apr 22 03:19:32 CST 2009