36 theRecHits4DLabel_(pset.getParameter<
InputTag>(
"recHits4DLabel")),
38 theCalibChamber_(pset.getUntrackedParameter<
string>(
"calibChamber",
"All")) {
40 LogVerbatim(
"Calibration") <<
"[DTVDriftSegmentCalibration] Constructor called!";
44 rootFile_ =
new TFile(rootFileName.c_str(),
"RECREATE");
49 TH1::SetDefaultSumw2(
true);
56 LogVerbatim(
"Calibration") <<
"[DTVDriftSegmentCalibration] Destructor called!";
73 int selWheel, selStation, selSector;
75 linestr >> selWheel >> selStation >> selSector;
76 chosenChamberId =
DTChamberId(selWheel, selStation, selSector);
77 LogVerbatim(
"Calibration") <<
" Chosen chamber: " << chosenChamberId << endl;
80 DTRecSegment4DCollection::id_iterator chamberIdIt;
81 for(chamberIdIt = all4DSegments->id_begin(); chamberIdIt != all4DSegments->id_end(); ++chamberIdIt){
84 if((
theCalibChamber_ !=
"All") && ((*chamberIdIt) != chosenChamberId))
continue;
88 LogTrace(
"Calibration") <<
" Booking histos for Chamber: " << *chamberIdIt;
98 segment != range.second; ++segment){
101 LogTrace(
"Calibration") <<
"Segment local pos (in chamber RF): " << (*segment).localPosition()
102 <<
"\nSegment global pos: " << chamber->
toGlobal((*segment).localPosition());
104 if( !
select_(*segment, event, eventSetup) )
continue;
107 if( (*segment).hasPhi() ) {
109 double segmentVDrift = segment->phiSegment()->vDrift();
110 if( segmentVDrift != 0.00 ){
117 if( (*segment).hasZed() ){
119 double segmentVDrift = segment->zSegment()->vDrift();
120 if( segmentVDrift != 0.00 ){
131 LogVerbatim(
"Calibration") <<
"[DTVDriftSegmentCalibration] Writing histos to file!" << endl;
134 vector<TH1F*>::const_iterator itHistTH1F = (*itChHistos).second.begin();
135 vector<TH1F*>::const_iterator itHistTH1F_end = (*itChHistos).second.end();
136 for(; itHistTH1F != itHistTH1F_end; ++itHistTH1F) (*itHistTH1F)->Write();
140 for(; itHistTH2F != itHistTH2F_end; ++itHistTH2F) (*itHistTH2F)->Write();
154 stringstream sector; sector << chId.
sector();
158 "_St" + station.str() +
159 "_Sec" + sector.str();
161 vector<TH1F*> histosTH1F;
162 histosTH1F.push_back(
new TH1F((
"hRPhiVDriftCorr" + chHistoName).c_str(),
"v-drift corr. from Phi segments", 200, -0.4, 0.4));
163 if(chId.
station() != 4) histosTH1F.push_back(
new TH1F((
"hRZVDriftCorr" + chHistoName).c_str(),
"v-drift corr. from Z segments", 200, -0.4, 0.4));
165 vector<TH2F*> histosTH2F;
166 histosTH2F.push_back(
new TH2F((
"hRPhiVDriftCorrVsSegmPosX" + chHistoName).c_str(),
"v-drift corr. vs. segment x position", 250, -125., 125., 200, -0.4, 0.4));
167 histosTH2F.push_back(
new TH2F((
"hRPhiVDriftCorrVsSegmPosY" + chHistoName).c_str(),
"v-drift corr. vs. segment y position", 250, -125., 125., 200, -0.4, 0.4));
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
edm::InputTag theRecHits4DLabel_
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.
virtual ~DTVDriftSegmentCalibration()
def setup(process, global_tag, zero_tesla=False)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
ChamberHistosMapTH1F theVDriftHistoMapTH1F_
ChamberHistosMapTH2F theVDriftHistoMapTH2F_
DTSegmentSelector select_
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
void bookHistos(DTChamberId)
std::string theCalibChamber_
void beginRun(const edm::Run &run, const edm::EventSetup &setup)
int station() const
Return the station number.
int wheel() const
Return the wheel number.
DTVDriftSegmentCalibration(const edm::ParameterSet &pset)