39 theRecHits4DLabel_(pset.getParameter<
InputTag>(
"recHits4DLabel")),
40 doTTrigCorrection_(pset.getUntrackedParameter<
bool>(
"doT0SegCorrection",
false)),
41 theCalibChamber_(pset.getUntrackedParameter<
string>(
"calibChamber",
"All")),
42 dbLabel_(pset.getUntrackedParameter<
string>(
"dbLabel",
"")) {
44 LogVerbatim(
"Calibration") <<
"[DTTTrigOffsetCalibration] Constructor called!";
48 rootFile_ =
new TFile(rootFileName.c_str(),
"RECREATE");
57 LogVerbatim(
"Calibration") <<
"[DTTTrigOffsetCalibration]: TTrig version: " << tTrig->
version() << endl;
63 LogVerbatim(
"Calibration") <<
"[DTTTrigOffsetCalibration] Destructor called!";
72 int selWheel, selStation, selSector;
74 linestr >> selWheel >> selStation >> selSector;
75 chosenChamberId =
DTChamberId(selWheel, selStation, selSector);
76 LogVerbatim(
"Calibration") <<
" chosen chamber " << chosenChamberId << endl;
88 DTRecSegment4DCollection::id_iterator chamberIdIt;
89 for(chamberIdIt = all4DSegments->id_begin(); chamberIdIt != all4DSegments->id_end(); ++chamberIdIt){
93 LogTrace(
"Calibration") <<
"Chamber Id: " << *chamberIdIt;
101 if((
theCalibChamber_ !=
"All") && ((*chamberIdIt) != chosenChamberId))
continue;
108 segment != range.second; ++segment){
110 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
111 <<
"\nSegment global pos: " << chamber->
toGlobal((*segment).localPosition());
113 if( !
select_(*segment, event, eventSetup) )
continue;
116 if( (*segment).hasPhi() ) {
118 if( (segment->phiSegment()->t0()) != 0.00 ){
122 if( (*segment).hasZed() ){
124 if( (segment->zSegment()->t0()) != 0.00 ){
135 LogVerbatim(
"Calibration") <<
"[DTTTrigOffsetCalibration] Writing histos to file!" << endl;
138 for(vector<TH1F*>::const_iterator itHist = (*itChHistos).second.begin();
139 itHist != (*itChHistos).second.end(); ++itHist) (*itHist)->Write();
149 vector<DTSuperLayerId> slIds;
154 for(vector<DTSuperLayerId>::const_iterator itSl = slIds.begin(); itSl != slIds.end(); ++itSl){
157 float ttrigSigma = 0;
162 float ttrigMeanNew = ttrigMean;
163 float ttrigSigmaNew = ttrigSigma;
164 float t0SegMean = (itSl->superLayer() != 2)?itChHistos->second[0]->GetMean():itChHistos->second[1]->GetMean();
166 float kFactorNew = (kFactor*ttrigSigma+t0SegMean)/ttrigSigma;
171 LogVerbatim(
"Calibration")<<
"[DTTTrigOffsetCalibration] Writing ttrig object to DB!" << endl;
173 string tTrigRecord =
"DTTtrigRcd";
181 LogTrace(
"Calibration") <<
" Booking histos for Chamber: " << chId;
186 stringstream sector; sector << chId.
sector();
190 "_St" + station.str() +
191 "_Sec" + sector.str();
213 histos.push_back(
new TH1F((
"hRPhiSegT0"+chHistoName).c_str(),
"t0 from Phi segments", 500, -60., 60.));
214 if(chId.
station() != 4) histos.push_back(
new TH1F((
"hRZSegT0"+chHistoName).c_str(),
"t0 from Z segments", 500, -60., 60.));
edm::InputTag theRecHits4DLabel_
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
int set(int wheelId, int stationId, int sectorId, int slId, float tTrig, float tTrms, float kFact, DTTimeUnits::type unit)
void beginRun(const edm::Run &run, const edm::EventSetup &setup) override
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
const std::string & version() const
access version
def setup(process, global_tag, zero_tesla=False)
ChamberHistosMap theT0SegHistoMap_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void bookHistos(DTChamberId)
~DTTTrigOffsetCalibration() override
const DTTtrig * tTrigMap_
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
std::string theCalibChamber_
DTSegmentSelector select_
int station() const
Return the station number.
int wheel() const
Return the wheel number.
static void writeToDB(std::string record, T *payload)
DTTTrigOffsetCalibration(const edm::ParameterSet &pset)