Analysis recipe to use CASTOR objects with 2010 CMS OpenData

Commissioning10 data period

Introduction

This section is valid for 900 GeV and 7 TeV datasets taken during the Commissioning10 period in 2010.
More specifically for data:
/MinimumBias/Commissioning10-07JunReReco_900GeV/RECO
/MinimumBias/Commissioning10-May19ReReco-v1/RECO
And for MC:
/MinBias_TuneZ2_900GeV_pythia6_cff_py_GEN_SIM_START311_V2_Dec11_v2/hvanhaev-MinBias_TuneZ2_900GeV_pythia6_cff_py_Step3_START42_V11_Dec11_v3-04745fc182f9123f750cb5f7764a36c5/USER
/MinBias_TuneZ2_7TeV_pythia6_cff_py_GEN_SIM_START311_V2_Dec11_v2/hvanhaev-MinBias_TuneZ2_7TeV_pythia6_cff_py_Step3_START42_V11_Dec11_v2-86bcdbe9c73956c342e477ba771c41c7/USER
/MinBias_Tune4C_900GeV_pythia8_cff_py_GEN_SIM_START311_V2_Dec11_v2/hvanhaev-MinBias_Tune4C_900GeV_pythia8_cff_py_Step3_START42_V11_Dec11_v2-04745fc182f9123f750cb5f7764a36c5/USER
/MinBias_Tune4C_7TeV_pythia8_cff_py_GEN_SIM_START311_V2_Dec11_v1/hvanhaev-MinBias_Tune4C_7TeV_pythia8_cff_py_Step3_START42_V11_Dec11_v1-86bcdbe9c73956c342e477ba771c41c7/USER

Installation and setup

Before you can analyse data taken with the CASTOR calorimeter you'll need install a few extra packages into the CMSSW software.
1) Install the CERN OpenData VM for 2010 data, for instructions see here: http://opendata.cern.ch/docs/cms-virtual-machine-2010. The recipe below are validated in version 'CMS-OpenData-1.1.2'.
2) Start up your VM and open the 'CMS shell'.
3) Install the correct version of CMSSW and activate it:
cmsrel CMSSW_4_2_8_lowpupatch1
cd CMSSW_4_2_8_lowpupatch1/src
cmsenv
4) When in CMSSW_4_2_8_lowpupatch1/src directory, download the additional necessary packages and compile them:
wget https://twiki.cern.ch/twiki/pub/CMS/CASTOROpenData2010/Commissioning10_additional_packages.tar
tar -xvf Commissioning10_additional_packages.tar
scram b
Note that following directories should appear in the CMSSW_4_2_8_lowpupatch1/src directory: RecoLocalCalo, RecoJets, data. If this is not the case then something went wrong when downloading/extracting the packages.

Usage

Once the above steps are executed you are basically ready to analyse CASTOR objects. Here we will specify what configuration snippets you will need to apply inside your typical 'demoanalyzer_cfg.py' file when you are coding an analyser in CMSSW.

First important step is to include a 'global tag' into your configuration file. To do this, please follow the instructions this CMS OpenData page: http://opendata.cern.ch/docs/cms-guide-for-condition-database and follow the steps in section 'For 2010 collision data' to include the 'FT_R_42_V10A::All' global tag.

Running on data

1) Add the following lines to the cfg file:
# load latest ChannelQuality conditions to remove the bad channels
process.es_ascii = cms.ESSource("CastorTextCalibrations",
    input = cms.VPSet(
                cms.PSet(
                    object = cms.string('ChannelQuality'),
                    file = cms.FileInPath('./data/castor_db2013/DumpCastorCondChannelQuality_Run135059.txt')
                ),
    )
)
process.es_prefer_castor = cms.ESPrefer('CastorTextCalibrations','es_ascii')

# import correct treatment of CASTOR objects
process.load('RecoLocalCalo.Castor.ReReco_data_cff')

# filter bad data
process.castorInvalidDataFilter = cms.EDFilter("CastorInvalidDataFilter")

2) If process.demo is the actual process that executes your analysis code, then you need to extend the cms.Path() that contains it until you have the following:

cms.Path(process.castorInvalidDataFilter*process.CastorReReco*process.demo)
It is important that process.demo is at the end of the path, and that the order of the path is respected. Note that the above 2 extensions in the cfg file of the analyser are always needed when analysing CASTOR objects in Commissioning10 data.

Running on Monte Carlo samples

1) Add the following lines to the cfg file:
# load latest ChannelQuality conditions to remove the bad channels
process.es_ascii = cms.ESSource("CastorTextCalibrations",
    input = cms.VPSet(
                cms.PSet(
                    object = cms.string('ChannelQuality'),
                    file = cms.FileInPath('./data/castor_db2013/DumpCastorCondChannelQuality_Run135059.txt')
                ),
    )
)
process.es_prefer_castor = cms.ESPrefer('CastorTextCalibrations','es_ascii')

# import correct treatment of CASTOR objects
process.load('RecoLocalCalo.Castor.ReReco_MC_cff')

2) If process.demo is the actual process that executes your analysis code, then you need to extend the cms.Path() that contains it until you have the following:

cms.Path(process.CastorReReco*process.demo)
It is important that process.demo is at the end of the path, and that the order of the path is respected. Note that the above 2 extensions in the cfg file of the analyser are always needed when analysing CASTOR objects in 2010 Monte Carlo samples.

Demo analysis

With this demo analysis you'll be able to cross check that everything is behaving as intended

DemoAnalyzer class

A demo analyser C++ class can be downloaded by:
wget https://twiki.cern.ch/twiki/pub/CMS/CASTOROpenData2010/DemoAnalyzer.cc
It contains code to read out all objects and make basic validation histograms. You can run it with the following python configuration files:
wget https://twiki.cern.ch/twiki/pub/CMS/CASTOROpenData2010/demoanalyzer_cfg_Commissioning10.py.txt
wget https://twiki.cern.ch/twiki/pub/CMS/CASTOROpenData2010/demoanalyzer_cfg_Comm10MC.py.txt
The first one is used with data, the second with MC samples. Before using remove the .txt file extension.

The demo code applies first some 'online' selections in the python configuration file (physics declared, remove beam background, remove CASTOR invalid data, trigger selection) and in the C++ class a further offline event selection is included that selects nondiffractive minimum bias events by requiring: exactly one good primary vertex, HF AND activity, and CASTOR activity. This event selection is the same as applied in the FWD-11-003 analysis.

Validation plots

After running the demo analyser you can plot the histograms stored in the output ROOT files. In this attachment you can find validation plots, if you get the same results than your framework is working as expected.

Run2010B data period

Introduction

These instructions are valid to use with Run2010B OpenData datasets. e.g. http://opendata.cern.ch/record/8

Installation and setup

Before you can analyse data taken with the CASTOR calorimeter you'll need install a few extra packages into the CMSSW software.
1) Install the CERN OpenData VM for 2010 data, for instructions see here: http://opendata.cern.ch/docs/cms-virtual-machine-2010. The recipe below are validated in version 'CMS-OpenData-1.1.2'.
2) Start up your VM and open the 'CMS shell'.
3) Install the correct version of CMSSW and activate it:
cmsrel CMSSW_4_2_8_lowpupatch1
cd CMSSW_4_2_8_lowpupatch1/src
cmsenv
4) When in CMSSW_4_2_8_lowpupatch1/src directory, download the additional necessary packages and compile them:
wget https://twiki.cern.ch/twiki/pub/CMS/CASTOROpenData2010/Run2010B_additional_packages.tar
tar -xvf Run2010B_additional_packages.tar
scram b
Note that following directories should appear in the CMSSW_4_2_8_lowpupatch1/src directory: RecoLocalCalo and RecoJets. If this is not the case then something went wrong when downloading/extracting the packages.

Usage

Once the above steps are executed you are basically ready to analyse CASTOR objects. Here we will specify what configuration snippets you will need to apply inside your typical 'demoanalyzer_cfg.py' file when you are coding an analyser in CMSSW.

First important step is to include a 'global tag' into your configuration file. To do this, please follow the instructions this CMS OpenData page: http://opendata.cern.ch/docs/cms-guide-for-condition-database and follow the steps in section 'For 2010 collision data' to include the 'FT_R_42_V10A::All' global tag.

Running on data

1) Add the following lines to the cfg file:
# import correct treatment of CASTOR objects
process.load('RecoLocalCalo.Castor.ReReco_data_cff')

# filter bad data
process.castorInvalidDataFilter = cms.EDFilter("CastorInvalidDataFilter")

2) If process.demo is the actual process that executes your analysis code, then you need to extend the cms.Path() that contains it until you have the following:

cms.Path(process.castorInvalidDataFilter*process.CastorReReco*process.demo)
It is important that process.demo is at the end of the path, and that the order of the path is respected. Note that the above 2 extensions in the cfg file of the analyser are always needed when analysing CASTOR objects in Run2010B data.

Running on Monte Carlo samples

NOTE: check if bad channels need to be excluded manually from MC, depends on what GT is used.
1) Add the following lines to the cfg file:
# import correct treatment of CASTOR objects
process.load('RecoLocalCalo.Castor.ReReco_MC_cff')

2) If process.demo is the actual process that executes your analysis code, then you need to extend the cms.Path() that contains it until you have the following:

cms.Path(process.CastorReReco*process.demo)
It is important that process.demo is at the end of the path, and that the order of the path is respected. Note that the above 2 extensions in the cfg file of the analyser are always needed when analysing CASTOR objects in 2010 Monte Carlo samples.

Demo analysis

With this demo analysis you'll be able to cross check that everything is behaving as intended

Information valid for all 2010 data

Examples to access all objects and their properties

Access RecHits

  // acces the CASTOR rechits
  Handle<CastorRecHitCollection> rechitcoll;
  iEvent.getByLabel("rechitcorrector",rechitcoll);

  //-- loop over the rechit collection
  if(rechitcoll.isValid()) {
       for(size_t i = 0; i < rechitcoll->size(); ++i) {
         const CastorRecHit & rh = (*rechitcoll)[i];
         HcalCastorDetId castorid = rh.id();
         
         hRecHit_map->Fill(castorid.sector(),castorid.module());
         hRecHit_module->Fill(castorid.module(),rh.energy());
         hRecHit_sector->Fill(castorid.sector(),rh.energy());
                        int rh_channel = 16*(castorid.module()-1) + castorid.sector();
         hRecHit_channel->Fill(rh_channel,rh.energy());
         hRecHit_energy->Fill(rh.energy());
     }
  }

Access CastorTowers

// access the CASTOR towers
edm::Handle<CastorTowerCollection> towercoll;
iEvent.getByLabel("CastorTowerReco",towercoll);

  if(towercoll.isValid()) {

    hTower_multi->Fill(towercoll->size());
    for(unsigned int i=0;i<towercoll->size();i++) {
      const CastorTower & castortower = (*towercoll)[i];
      hTower_energy->Fill(castortower.energy());
      hTower_phi->Fill(castortower.phi());
      hTower_fem->Fill(castortower.fem());
      hTower_eem->Fill(castortower.emEnergy());
      hTower_ehad->Fill(castortower.hadEnergy());
      hTower_depth->Fill(castortower.depth());
      hTower_fhot->Fill(castortower.fhot());
      hTower_ncell->Fill(castortower.rechitsSize());
         
    }
  }

Access CastorJets

  // access the CASTOR jets
  edm::Handle<edm::View< reco::BasicJet > > basicjetcoll;  //-- uncorrected jets
  edm::Handle<reco::CastorJetIDValueMap> jetIdMap;

  iEvent.getByLabel("ak5BasicJets",basicjetcoll);
  iEvent.getByLabel("ak5CastorJetID",jetIdMap);

  if(basicjetcoll.isValid()) {

    for(edm::View<reco::BasicJet>::const_iterator ibegin = basicjetcoll->begin(), iend = basicjetcoll->end(), ijet = ibegin; ijet != iend; ++ijet) {

      unsigned int idx = ijet - ibegin;
      const BasicJet & basicjet = (*basicjetcoll)[idx];
     
      hJet_energy->Fill(basicjet.energy());
      hJet_phi->Fill(basicjet.phi());

      edm::RefToBase<reco::BasicJet> jetRef = basicjetcoll->refAt(idx);
      reco::CastorJetID const & jetId = (*jetIdMap)[jetRef];

      hJet_fem->Fill(jetId.fem);
      hJet_eem->Fill(jetId.emEnergy);
      hJet_ehad->Fill(jetId.hadEnergy);

      hJet_width->Fill(jetId.width);
      hJet_depth->Fill(jetId.depth);
      hJet_fhot->Fill(jetId.fhot);
      hJet_sigmaz->Fill(jetId.sigmaz);
      hJet_ntower->Fill(jetId.nTowers);

    }
  }

Jet calibration factors

The idea would be to download them here with instructions on how to apply them

-- HansVanHaevermaet - 2018-09-10

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivetar Commissioning10_additional_packages.tar r2 r1 manage 530.0 K 2018-09-17 - 16:12 HansVanHaevermaet Commissioning10 additional packages
Unknown file formatcc DemoAnalyzer.cc r1 manage 19.2 K 2018-12-17 - 15:07 HansVanHaevermaet Demo analyser code and python cfg files for Commissioning10
Compressed Zip archivetar Run2010B_additional_packages.tar r1 manage 520.0 K 2018-09-17 - 16:33 HansVanHaevermaet Run2010B additional packages
Texttxt demoanalyzer_cfg_Comm10MC.py.txt r1 manage 3.1 K 2018-12-17 - 15:07 HansVanHaevermaet Demo analyser code and python cfg files for Commissioning10
Texttxt demoanalyzer_cfg_Commissioning10.py.txt r1 manage 5.7 K 2018-12-17 - 15:07 HansVanHaevermaet Demo analyser code and python cfg files for Commissioning10
Edit | Attach | Watch | Print version | History: r11 | r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2018-12-17 - HansVanHaevermaet
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    CMSPublic All webs login

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