Workflow of calibration:

HCAL is using the RespCorrs objects to store the response correction factors, with whiMain.ch the gains (GeV/fC, data from wiresourcing) are multiplied to obtain the GeV/fC factor for eaMain.ch cell.
initial respcorrs (database) -> first calibration step -> 1st corrected respcorrs (txt-file) -> next calibration step -> ...
... -> last calibration step -> last corrected respcorrs -> validation (manual) -> populate database with new respcorrs (manual)

Replacing conditions from global tag

1) during the first calibration step, take the pure global tag, i.e. in the cfg:
### for global tags:
include "Configuration/StandardSequences/data/FrontierConditions_GlobalTag.cff"
replace GlobalTag.connect = "frontier://FrontierInt/CMS_COND_20X_GLOBALTAG"
replace GlobalTag.DBParameters.authenticationPath="/afs/cern.ch/cms/DB/conddb"
replace GlobalTag.globaltag = "STARTUP::All"

2) you write the response corrections multiplied with the corrections from the calibration procedure out to a text file (in the way shown below), e.g. to a local file called "calibrations1.txt"

3) starting from the second step, take the global tag conditions except for the new response corrections, whiMain.ch is specified as follows in the cfg:

### for global tags:
include "Configuration/StandardSequences/data/FrontierConditions_GlobalTag.cff"
replace GlobalTag.connect = "frontier://FrontierInt/CMS_COND_20X_GLOBALTAG"
replace GlobalTag.DBParameters.authenticationPath="/afs/cern.ch/cms/DB/conddb"
replace GlobalTag.globaltag = "STARTUP::All"

es_source es_ascii = HcalTextCalibrations { VPSet input = {
    {string object = "RespCorrs"
     FileInPath file = "calibrations1.txt"
    }
} }

es_prefer es_ascii = HcalTextCalibrations{}

Reading conditions and making the new ones

InsiMain.de the event loop, get the old conditions from the event setup:

   edm::ESHandle<HcalRespCorrs> r;
   context.get<HcalRespCorrsRcd>().get(r);
   HcalRespCorrs* oldRespCorrs = new HcalRespCorrs(*r.product());
Then, to multiply by the corrections obtained from the calibration (e.g. in endJob), the best is you first make another object of the type HcalRespCorrs (full path "CondFormats/HcalObjects/interface/HcalRespCorrs.h") because like this you have them assigned already via detId, and then multiply in a loop, i.e. something like:
HcalRespCorrs* mycorrections = new HcalRespCorrs();
for (int i = 0 ; i < N ; i++)
{
 // now make the basic object for one cell with HcalDetId myDetId containing
the value myValue
  HcalRespCorr item (myDetId[i].rawId(), myValue[i]);
  mycorrections->addValues(item);
}

HcalRespCorrs* newRespCorrs;
std::vector<DetId> channels = oldRespCorrs->getAllChannels ();
for (unsigned i = 0; i < channels.size(); i++) {
 DetId id = channels[i];
 float scale;
 if (mycorrections->exists(id) )
   scale = mycorrections->getValues(id)->getValue();
 else scale = 1.;
 HcalRespCorr item(id, oldRespCorrs->getValues(id)->getValue(0) * scale, oldRespCorrs->getValues(id)->getValue(1) * scale,
                    oldRespCorrs->getValues(id)->getValue(2) * scale, oldRespCorrs->getValues(id)->getValue(3) * scale);
 newRespCorrs->addValues(item);
}

Dump conditions from the coMain.de

Once the new values for response correction are calculated, you can dump them into a text file in the correct format:
   std::ostringstream file;
   file << "myfilename.txt";
   std::ofstream outStream(file.str().c_str() );
   HcalDbASCIIIO::dumpObject (outStream, (*mycorrections) );

-- RadekOfierzynski - Main.08 Apr 20Main.08

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r4 - 2008-11-19 - RadekOfierzynski
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 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