S & C Review:

Introduction

  • Used components of the CMS software and computing environment
    • CMSSW: CMS software framework and EDM
    • DBS/DLS discovery webpage:
      • DBS: Dataset Bookkeeping System, database of datasets and their files
      • DLS: Dataset Location Service, database of location(s) of datasets (which dataset is available at which site)
    • CRAB: CMS Remote Analysis Builder, user tool to submit and control batch analysis jobs to the GRID

  • CMSSW:
    • Based on a bus model, user schedules modules which are run by the main framework application: cmsRun
    • User interaction with the framework application is done through configuration file called parameter-set
    • Parameter-set instantiates modules, instance is labeled by the module label
    • 4 different types of modules, two main user modules:
      • EDProducer: uses input from the event and produces new output which is stored in the event
      • EDAnalyzer: uses input form the event and performs operations on input, does not store anything in the event (preparation shown in this demo)

  • Locations:
    • User interface (UI): interactive login nodes at Fermilab (UAF)
    • GRID sites: one of the seven US-CMS T2 sites
      • UC San Diego (UCSD, OSG middleware)
      • University of Florida (UFL, OSG middleware)
      • University of Nebraska, Lincoln (UNL, OSG middleware)
      • University of Wisconsin, Madison (Wisconsin, OSG middleware)
      • California Institute of Technology (Caltech, OSG middleware)
      • Massachusetts Institute of Technology (MIT, OSG middleware)
      • Purdue University (Purdue, OSG middleware)

  • Conventions:
    • Shell-commands:
example-command
    • Code
example-code
    • New code added to code fragment
new code 

  • Demo is showing analysis workflow: discover the Higgs
    • Analysis code preparation in the CMSSW framework:
      • write EDAnalyzer accessing reconstructed tracks and writing out ROOT file with histograms:
        • transverse momentum of reconstructed tracks: pT
        • di-track invariant mass: mmu,mu
        • invariant mass of two di-track-objects: mZ,Z
    • Dataset discovery: use DBS/DLS discovery page to check availability and location of datasample: Higgs->ZZ->4mu
    • Analysis job execution on the GRID using CRAB

Setup environment and prepare user area

  • Setup CMS software environment
source /uscmst1/prod/sw/cms/shrc uaf
  • Prepare user area
scramv1 p CMSSW CMSSW_1_2_0
cd CMSSW_1_2_0/src
eval `scramv1 runtime -sh`
  • Create analysis module directory
mkdir Demo
cd Demo

Analysis code preparation

  • Use framework template script to prepare EDAnalyzer skeleton
mkedanlzr -track MyTrackAnalyzer
  • Include root libraries into !BuildFile (CMS makefile)
<use name=FWCore/Framework>
<use name=Foundation/PluginManager>
<use name=FWCore/ParameterSet>
<flags SEAL_PLUGIN_NAME="DemoMyTrackAnalyzer">
<use name=DataFormats/TrackReco>
<use name=root>
<export>
   <lib name=DemoMyTrackAnalyzer>
   <use name=FWCore/Framework>
   <use name=Foundation/PluginManager>
   <use name=FWCore/ParameterSet>
   <use name=DataFormats/TrackReco>
   <use name=root>
</export>
  • Add analysis code and output ROOT file for histograms to skeleton:
// -*- C++ -*-
//
// Package:    MyTrackAnalyzer
// Class:      MyTrackAnalyzer
// 
/**\class MyTrackAnalyzer MyTrackAnalyzer.cc Demo/MyTrackAnalyzer/src/MyTrackAnalyzer.cc

 Description: <one line class summary>

 Implementation:
     <Notes on implementation>
*/
//
// Original Author:  Oliver Gutsche
//         Created:  Mon Jan 15 10:28:42 CST 2007
// $Id: SaCReviewDemo.txt,v 1.6 2007/01/18 19:26:50 OliverGutsche Exp $
//
//


// system include files
#include <memory>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/InputTag.h"
#include "DataFormats/TrackReco/interface/Track.h"

#include "TH1D.h"
#include "TFile.h"
#include "TLorentzVector.h"

//
// class decleration
//

class MyTrackAnalyzer : public edm::EDAnalyzer {
   public:
      explicit MyTrackAnalyzer(const edm::ParameterSet&);
      ~MyTrackAnalyzer();

   private:
      virtual void beginJob(const edm::EventSetup&) ;
      virtual void analyze(const edm::Event&, const edm::EventSetup&);
      virtual void endJob() ;

      // ----------member data ---------------------------
      edm::InputTag trackTags_; //used to select what tracks to read from configuration file
      TH1D *pt_;
      TH1D *mmumu_;
      TH1D *mzz_;
      TFile *file_;
};

//
// constants, enums and typedefs
//

//
// static data member definitions
//

//
// constructors and destructor
//
MyTrackAnalyzer::MyTrackAnalyzer(const edm::ParameterSet& iConfig)
:
 trackTags_(iConfig.getUntrackedParameter<edm::InputTag>("tracks"))
{
   //now do what ever initialization is needed
   file_ = new TFile("histograms.root","RECREATE");

   pt_ = new TH1D("pt","Track p_{T}",250,0.,250.);
   pt_->Sumw2();
   pt_->SetXTitle("p_{T} [GeV]");
   pt_->SetYTitle("Events");

  mmumu_ = new TH1D("mmumu","m_{#mu#mu}",250,0.,250.);
  mmumu_->Sumw2();
  mmumu_->SetXTitle("m_{#mu#mu} [GeV]");
  mmumu_->SetYTitle("Events");

  mzz_ = new TH1D("mzz","m_{ZZ}",250,0.,250.);
  mzz_->Sumw2();
  mzz_->SetXTitle("m_{ZZ} [GeV]");
  mzz_->SetYTitle("Events");

}


MyTrackAnalyzer::~MyTrackAnalyzer()
{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

  file_->Write();
  file_->Close();

}


//
// member functions
//

// ------------ method called to for each event  ------------
void
MyTrackAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
{
   using namespace edm;
   using reco::TrackCollection;
  
   Handle<TrackCollection> tracks;
   iEvent.getByLabel(trackTags_,tracks);
   for(TrackCollection::const_iterator itTrack = tracks->begin();
       itTrack != tracks->end();
       ++itTrack) {
     pt_->Fill(itTrack->pt());
     std::vector<TLorentzVector> mumus;
     TLorentzVector track1(itTrack->px(),itTrack->py(),itTrack->pz(),std::sqrt(itTrack->p()*itTrack->p()+0.10566*0.10566));
     for(TrackCollection::const_iterator itTrack2 = tracks->begin();
         itTrack2 != tracks->end();
         ++itTrack2) {
       if ( itTrack->charge() != itTrack2->charge() ) {
         TLorentzVector track2(itTrack2->px(),itTrack2->py(),itTrack2->pz(),std::sqrt(itTrack2->p()*itTrack2->p()+0.10566*0.10566));
         TLorentzVector mumu = track1 + track2;

         mmumu_->Fill(mumu.M());
         mumus.push_back(mumu);

       }
     }

     if ( mumus.size() > 1 ) {
       for ( std::vector<TLorentzVector>::iterator mumu1 = mumus.begin();
             mumu1 != mumus.end();
             ++mumu1) {
         if ( mumu1->M() > 80. && mumu1->M() < 100.0 ) {
           for ( std::vector<TLorentzVector>::iterator mumu2 = mumu1+1;
                 mumu2 != mumus.end();
                 ++mumu2) {
             if ( mumu2->M() > 80. && mumu2->M() < 100.0 ) {
               TLorentzVector zz = *mumu1 + *mumu2;
               mzz_->Fill(zz.M());
             }
           }
         }
       }
     }
  }
}


// ------------ method called once each job just before starting event loop  ------------
void 
MyTrackAnalyzer::beginJob(const edm::EventSetup&)
{
}

// ------------ method called once each job just after ending the event loop  ------------
void 
MyTrackAnalyzer::endJob() {
}

//define this as a plug-in
DEFINE_FWK_MODULE(MyTrackAnalyzer);
  • Prepare parameter-set to run EDAnalyzer:
process A = {

  source = PoolSource {
        untracked vstring fileNames = {
                "file:test.root"
        }
        untracked int32 maxEvents = -1
        untracked uint32 skipEvents = 0
  }

  module higgs = MyTrackAnalyzer {
        untracked InputTag tracks = ctfWithMaterialTracks
  }

  path p = {
        higgs
  }

}

Dataset discovery

Analysis job execution on the GRID

source /uscmst1/prod/grid/CRAB/crab.sh
  • prepare CRAB configuration file
[CRAB]
jobtype                = cmssw
scheduler              = condor_g

[CMSSW]
datasetpath            = 
pset                   = 
total_number_of_events = 100
events_per_job         = 10
output_file            = 

[EDG]
se_white_list          = 
virtual_organization   = cms
lcg_catalog_type       = lfc
lfc_host               = lfc-cms-test.cern.ch
lfc_home               = /grid/cms
  • create jobs
crab -create
  • submit jobs
crab -submit all -continue
  • status check
crab -status -c
  • output retrieval
crab -getoutput -c

Analysis finalization: histograms

  • post processing: add histogram files of individual jobs
cd crab_?_*_*/res
hadd histograms.root *.root
  • Show histograms
root histograms.root
pt->Draw();
mmumu->Draw();
mzz->Draw();

Monitoring

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2007-03-22 - OliverGutsche
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback