CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
PhiSymmetryCalibration_step2_SM Class Reference

#include <PhiSymmetryCalibration_step2_SM.h>

Inheritance diagram for PhiSymmetryCalibration_step2_SM:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
void fillConstantsHistos ()
 
void fillHistos ()
 
void outResidHistos ()
 
 PhiSymmetryCalibration_step2_SM (const edm::ParameterSet &iConfig)
 
void readEtSums ()
 
void setUp (const edm::EventSetup &setup)
 
void setupResidHistos ()
 
 ~PhiSymmetryCalibration_step2_SM () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::vector< DetIdbarrelCells
 
std::vector< TH2F * > correl_barl_histos
 
std::vector< TH2F * > correl_endc_histos
 
EcalGeomPhiSymHelper e_
 
std::vector< DetIdendcapCells
 
float epsilon_M_barl [kBarlRings][kBarlWedges][kSides]
 
double epsilon_M_barl_SM_ [kBarlRings][int(kBarlWedges/nscx)][kSides]
 
float epsilon_M_endc [kEndcWedgesX][kEndcWedgesY][kSides]
 
double esum_barl_ [kBarlRings][kBarlWedges][kSides]
 
double esum_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
double esumMean_barl_ [kBarlRings]
 
double esumMean_endc_ [kEndcEtaRings]
 
double etsum_barl_ [kBarlRings][kBarlWedges][kSides]
 
double etsum_barl_SM_ [kBarlRings][int(kBarlWedges/nscx)][kSides]
 
double etsum_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
double etsum_endc_uncorr [kEndcWedgesX][kEndcWedgesX][kSides]
 
double etsumMean_barl_ [kBarlRings]
 
double etsumMean_barl_SM_ [kBarlRings]
 
double etsumMean_endc_ [kEndcEtaRings]
 
bool firstpass_
 
bool have_initial_miscalib_
 
std::string initialmiscalibfile_
 
double k_barl_ [kBarlRings]
 
double k_endc_ [kEndcEtaRings]
 
std::vector< TH1F * > miscal_resid_barl_histos
 res miscalib histos More...
 
std::vector< TH1F * > miscal_resid_endc_histos
 
EcalIntercalibConstants miscalib_
 initial miscalibration applied if any) More...
 
int nBads_barl_SM_ [kBarlRings][int(kBarlWedges/nscx)][kSides]
 
EcalIntercalibConstants newCalibs_
 calib constants that we are going to calculate More...
 
unsigned int nhits_barl_ [kBarlRings][kBarlWedges][kSides]
 
unsigned int nhits_endc_ [kEndcWedgesX][kEndcWedgesX][kSides]
 
std::string oldcalibfile_
 
EcalIntercalibConstants oldCalibs_
 the old calibration constants (when reiterating, the last ones derived) More...
 
float rawconst_barl [kBarlRings][kBarlWedges][kSides]
 
float rawconst_endc [kEndcWedgesX][kEndcWedgesX][kSides]
 
bool reiteration_
 
int statusThreshold_
 

Static Private Attributes

static const int nscx =20
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 12 of file PhiSymmetryCalibration_step2_SM.h.

Constructor & Destructor Documentation

PhiSymmetryCalibration_step2_SM::PhiSymmetryCalibration_step2_SM ( const edm::ParameterSet iConfig)

Definition at line 26 of file PhiSymmetryCalibration_step2_SM.cc.

References edm::ParameterSet::getUntrackedParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

26  {
27 
29  iConfig.getUntrackedParameter<int>("statusThreshold",0);
31  iConfig.getUntrackedParameter<bool>("haveInitialMiscalib",false);
33  iConfig.getUntrackedParameter<std::string>("initialmiscalibfile",
34  "InitialMiscalib.xml");
36  iConfig.getUntrackedParameter<std::string>("oldcalibfile",
37  "EcalIntercalibConstants.xml");
38  reiteration_ = iConfig.getUntrackedParameter<bool>("reiteration",false);
39  firstpass_=true;
40 }
T getUntrackedParameter(std::string const &, T const &) const
PhiSymmetryCalibration_step2_SM::~PhiSymmetryCalibration_step2_SM ( )
override

Definition at line 23 of file PhiSymmetryCalibration_step2_SM.cc.

23 {}

Member Function Documentation

void PhiSymmetryCalibration_step2_SM::analyze ( const edm::Event ev,
const edm::EventSetup se 
)
override

Definition at line 42 of file PhiSymmetryCalibration_step2_SM.cc.

43  {
44 
45  if (firstpass_) {
46  setUp(se);
47  firstpass_=false;
48  }
49 }
void setUp(const edm::EventSetup &setup)
void PhiSymmetryCalibration_step2_SM::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 138 of file PhiSymmetryCalibration_step2_SM.cc.

References createfilelist::int, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, and Validation_hcalonly_cfi::sign.

138  {
139 
140 
141  for (int ieta=0; ieta<kBarlRings; ieta++) {
142  for (int iphi=0; iphi<kBarlWedges; iphi++) {
143  for (int sign=0; sign<kSides; sign++) {
144  int iphi_r=int(iphi/nscx);
145 
146  etsum_barl_[ieta][iphi][sign]=0.;
147  nhits_barl_[ieta][iphi][sign]=0;
148  esum_barl_[ieta][iphi][sign]=0.;
149  etsum_barl_SM_[ieta][iphi_r][sign]=0;
150  nBads_barl_SM_[ieta][iphi_r][sign]=0;
151  epsilon_M_barl_SM_[ieta][iphi_r][sign]=0;
152  }
153  }
154  etsumMean_barl_SM_[ieta]=0.;
155  }
156 
157  for (int ix=0; ix<kEndcWedgesX; ix++) {
158  for (int iy=0; iy<kEndcWedgesY; iy++) {
159  for (int sign=0; sign<kSides; sign++) {
160  etsum_endc_[ix][iy][sign]=0.;
161  nhits_endc_[ix][iy][sign]=0;
162  esum_endc_[ix][iy][sign]=0.;
163 
164  }
165  }
166  }
167 
168  readEtSums();
170 }
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kBarlRings
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kSides
int nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kBarlWedges
static const int kEndcWedgesX
double esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double epsilon_M_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
double esum_barl_[kBarlRings][kBarlWedges][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2_SM::endJob ( void  )
overridevirtual

this is the new constant, or better, the correction to be applied to the old constant

residual miscalibraition / expected precision

Reimplemented from edm::EDAnalyzer.

Definition at line 172 of file PhiSymmetryCalibration_step2_SM.cc.

References funct::abs(), EcalCondHeader::datasource_, EcalCondHeader::date_, RecoTauValidation_cfi::header, EBDetId::ieta(), createfilelist::int, EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, EcalCondHeader::method_, MillePedeFileConverter_cfg::out, relativeConstraints::ring, Validation_hcalonly_cfi::sign, EcalCondHeader::since_, AlCaHLTBitMon_QueryRunRegistry::string, EcalCondHeader::tag_, EcalCondHeader::version_, EcalFloatCondObjectContainerXMLTranslator::writeXML(), EBDetId::zside(), and EEDetId::zside().

Referenced by o2olib.O2ORunMgr::executeJob().

172  {
173 
174  if (firstpass_) {
175  edm::LogError("PhiSym")<< "Must process at least one event-Exiting" <<endl;
176  return;
177 
178  }
179 
180  // Here the real calculation of constants happens
181 
182  // perform the area correction for endcap etsum
183  // NOT USED ANYMORE
184 
185  /*
186  for (int ix=0; ix<kEndcWedgesX; ix++) {
187  for (int iy=0; iy<kEndcWedgesY; iy++) {
188 
189  int ring = e_.endcapRing_[ix][iy];
190 
191  if (ring!=-1) {
192  for (int sign=0; sign<kSides; sign++) {
193  etsum_endc_uncorr[ix][iy][sign] = etsum_endc_[ix][iy][sign];
194  etsum_endc_[ix][iy][sign]*=meanCellArea_[ring]/cellArea_[ix][iy];
195  }
196  }
197  }
198  }
199  */
200 
201  // ETsum histos, maps and other usefull histos (area,...)
202  // are filled and saved here
203  fillHistos();
204 
205  // write ETsum mean for all rings
206  std::ofstream etsumMean_barl_out("etsumMean_barl.dat",ios::out);
207  for (int ieta=0; ieta<kBarlRings; ieta++) {
208  etsumMean_barl_out << ieta << " " << etsumMean_barl_[ieta] << endl;
209  }
210  etsumMean_barl_out.close();
211 
212  std::ofstream etsumMean_endc_out("etsumMean_endc.dat",ios::out);
213  for (int ring=0; ring<kEndcEtaRings; ring++) {
214  etsumMean_endc_out << e_.cellPos_[ring][50].eta() << " " << etsumMean_endc_[ring] << endl;
215  }
216  etsumMean_endc_out.close();
217 
218 
219  // determine barrel calibration constants
220  for (int ieta=0; ieta<kBarlRings; ieta++) {
221  for (int iphi=0; iphi<kBarlWedges; iphi++) {
222  for (int sign=0; sign<kSides; sign++) {
223 
224 
225  // sc
226  int iphi_r = int(iphi/nscx);
227 
228  //if(nBads_barl_SM_[ieta][iphi_r][sign]>0){
229  // std::cout << "ETSUM" << etsum_barl_SM_[ieta][iphi_r][sign] << " " <<ieta << " " << iphi_r << " " << sign << " " << nBads_barl_SM_[ieta][iphi_r][sign]<< endl;
230  //}
231 
232  float epsilon_T_SM =
233  etsum_barl_SM_[ieta][iphi_r][sign] /etsumMean_barl_SM_[ieta] -1.;
234 
235  epsilon_M_barl_SM_[ieta][iphi_r][sign] = epsilon_T_SM/k_barl_[ieta];
236 
237  if(e_.goodCell_barl[ieta][iphi][sign]){
238  float etsum = etsum_barl_[ieta][iphi][sign];
239  float epsilon_T = (etsum/etsumMean_barl_[ieta]) - 1.;
240  rawconst_barl[ieta][iphi][sign] = epsilon_T + 1.;
241  epsilon_M_barl[ieta][iphi][sign] = epsilon_T/k_barl_[ieta];
242 
243 
244  } else {
245  rawconst_barl[ieta][iphi][sign] = 1.;
246  epsilon_M_barl[ieta][iphi][sign] = 0.;
247  } //if
248  } //sign
249  } //iphi
250  } //ieta
251 
252  // determine endcap calibration constants
253  for (int ix=0; ix<kEndcWedgesX; ix++) {
254  for (int iy=0; iy<kEndcWedgesY; iy++) {
255  for (int sign=0; sign<kSides; sign++) {
256  int ring = e_.endcapRing_[ix][iy];
257  if (ring!=-1 && e_.goodCell_endc[ix][iy][sign]) {
258  float etsum = etsum_endc_[ix][iy][sign];
259  float epsilon_T = (etsum/etsumMean_endc_[ring]) - 1.;
260  rawconst_endc[ix][iy][sign] = epsilon_T + 1.;
261  epsilon_M_endc[ix][iy][sign] = epsilon_T/k_endc_[ring];
262  } else {
263  epsilon_M_endc[ix][iy][0] = 0.;
264  epsilon_M_endc[ix][iy][1] = 0.;
265  rawconst_endc[ix][iy][0] = 1.;
266  rawconst_endc[ix][iy][1] = 1.;
267  } //if
268  } //sign
269  } //iy
270  } //ix
271 
272 
273 
274  // output sc calibration
275  std::fstream scfile("sccalibration.dat",std::ios::out);
276  for (int ieta =0; ieta< kBarlRings; ++ieta){
277  for (int iphi_r =0; iphi_r< int(kBarlWedges/nscx);++iphi_r){
278  for (int sign=0; sign<kSides; sign++) {
279  scfile<< ieta << " " << iphi_r << " " <<sign << " "
280  << 1/(1+epsilon_M_barl_SM_[ieta][iphi_r][sign] )<< std::endl;
281  }
282  }
283  }
284 
285  std::string newcalibfile("EcalIntercalibConstants_new.xml");
286 
287 
288 
289  TFile ehistof("ehistos.root","recreate");
290 
291  TH1D ebhisto("eb","eb",100, 0.,2.);
292 
293  std::vector<DetId>::const_iterator barrelIt=barrelCells.begin();
294  for (; barrelIt!=barrelCells.end(); barrelIt++) {
295  EBDetId eb(*barrelIt);
296  int ieta = abs(eb.ieta())-1;
297  int iphi = eb.iphi()-1;
298  int sign = eb.zside()>0 ? 1 : 0;
299 
302  newCalibs_[eb] = oldCalibs_[eb]/(1+epsilon_M_barl[ieta][iphi][sign]);
303 
304  if(e_.goodCell_barl[ieta][iphi][sign]){
305 
306  ebhisto.Fill(newCalibs_[eb]);
307 
309  miscal_resid_barl_histos[ieta]->Fill(miscalib_[eb]*newCalibs_[eb]);
310  correl_barl_histos[ieta]->Fill(miscalib_[eb],newCalibs_[eb]);
311 
312  }
313 
314  }// barrelit
315 
316  TH1D eehisto("ee","ee",100, 0.,2.);
317  std::vector<DetId>::const_iterator endcapIt=endcapCells.begin();
318 
319  for (; endcapIt!=endcapCells.end(); endcapIt++) {
320  EEDetId ee(*endcapIt);
321  int ix = ee.ix()-1;
322  int iy = ee.iy()-1;
323  int sign = ee.zside()>0 ? 1 : 0;
324 
325  newCalibs_[ee] = oldCalibs_[ee]/(1+epsilon_M_endc[ix][iy][sign]);
326 
327 
328  if(e_.goodCell_endc[ix][iy][sign]){
329 
330  eehisto.Fill(newCalibs_[ee]);
332  newCalibs_[ee]);;
333 
334  correl_endc_histos[e_.endcapRing_[ix][iy]]->Fill(miscalib_[ee],
335  newCalibs_[ee]);
336 
337  }
338  }//endcapit
339  // Write xml file
341  header.method_="phi symmetry";
342  header.version_="0";
343  header.datasource_="testdata";
344  header.since_=1;
345  header.tag_="unknown";
346  header.date_="Mar 24 1973";
347 
349  newCalibs_ );
350 
351  eehisto.Write();
352  ebhisto.Write();
353  ehistof.Close();
354 
356 
357  outResidHistos();
358 
359 }
std::string datasource_
static int writeXML(const std::string &filename, const EcalCondHeader &header, const EcalFloatCondObjectContainer &record)
cond::Time_t since_
EcalIntercalibConstants miscalib_
initial miscalibration applied if any)
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
std::string date_
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
std::string version_
GlobalPoint cellPos_[kEndcWedgesX][kEndcWedgesY]
double etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kSides
float epsilon_M_barl[kBarlRings][kBarlWedges][kSides]
static const int kBarlWedges
static const int kEndcWedgesX
int endcapRing_[kEndcWedgesX][kEndcWedgesY]
static const int kEndcEtaRings
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
std::string tag_
double epsilon_M_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
float epsilon_M_endc[kEndcWedgesX][kEndcWedgesY][kSides]
std::string method_
float rawconst_barl[kBarlRings][kBarlWedges][kSides]
EcalIntercalibConstants newCalibs_
calib constants that we are going to calculate
T eta() const
Definition: PV3DBase.h:76
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
float rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2_SM::fillConstantsHistos ( )

Definition at line 364 of file PhiSymmetryCalibration_step2_SM.cc.

References f, kBarlRings, kBarlWedges, kEndcWedgesX, kEndcWedgesY, kSides, Validation_hcalonly_cfi::sign, and EEDetId::validDetId().

364  {
365 
366  TFile f("CalibHistos.root","recreate");
367 
368  TH2F barreletamap("barreletamap","barreletamap",171, -85,86,100,0.,2.);
369  TH2F barreletamapraw("barreletamapraw","barreletamapraw",171, -85,86,100,0.,2.);
370 
371  TH2F barrelmapold("barrelmapold","barrelmapold",360,1.,361.,171,-85.,86.);
372  TH2F barrelmapnew("barrelmapnew","barrelmapnew",360,1.,361.,171,-85.,86.);
373  TH2F barrelmapratio("barrelmapratio","barrelmapratio",360,1.,361.,171,-85.,86.);
374 
375  TH1F rawconst_endc_h("rawconst_endc","rawconst_endc",100,0.,2.);
376  TH1F const_endc_h("const_endc","const_endc",100,0.,2.);
377 
378  TH1F oldconst_endc_h("oldconst_endc","oldconst_endc;oldCalib;",200,0,2);
379  TH2F newvsraw_endc_h("newvsraw_endc","newvsraw_endc;rawConst;newCalib",200,0,2,200,0,2);
380 
381  TH2F endcapmapold_plus("endcapmapold_plus","endcapmapold_plus",100,1.,101.,100,1.,101.);
382  TH2F endcapmapnew_plus("endcapmapnew_plus","endcapmapnew_plus",100,1.,101.,100,1.,101.);
383  TH2F endcapmapratio_plus("endcapmapratio_plus","endcapmapratio_plus",100,1.,101.,100,1.,101.);
384 
385  TH2F endcapmapold_minus("endcapmapold_minus","endcapmapold_minus",100,1.,101.,100,1.,101.);
386  TH2F endcapmapnew_minus("endcapmapnew_minus","endcapmapnew_minus",100,1.,101.,100,1.,101.);
387  TH2F endcapmapratio_minus("endcapmapratio_minus","endcapmapratio_minus",100,1.,101.,100,1.,101.);
388 
389 
390  for (int sign=0; sign<kSides; sign++) {
391 
392  int thesign = sign==1 ? 1:-1;
393 
394  for (int ieta=0; ieta<kBarlRings; ieta++) {
395  for (int iphi=0; iphi<kBarlWedges; iphi++) {
396  if(e_.goodCell_barl[ieta][iphi][sign]){
397 
398  EBDetId eb(thesign*( ieta+1 ), iphi+1);
399  //int mod20= (iphi+1)%20;
400  //if (mod20==0 || mod20==1 ||mod20==2) continue; // exclude SM boundaries
401  barreletamap.Fill(ieta*thesign + thesign,newCalibs_[eb]);
402  barreletamapraw.Fill(ieta*thesign + thesign,rawconst_barl[ieta][iphi][sign]);
403 
404  barrelmapold.Fill(iphi+1,ieta*thesign + thesign, oldCalibs_[eb]);
405  barrelmapnew.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]);
406  barrelmapratio.Fill(iphi+1,ieta*thesign + thesign, newCalibs_[eb]/oldCalibs_[eb]);
407  }//if
408  }//iphi
409  }//ieta
410 
411  for (int ix=0; ix<kEndcWedgesX; ix++) {
412  for (int iy=0; iy<kEndcWedgesY; iy++) {
413  if (e_.goodCell_endc[ix][iy][sign]){
414  if (! EEDetId::validDetId(ix+1, iy+1,thesign)) continue;
415  EEDetId ee(ix+1, iy+1,thesign);
416 
417  rawconst_endc_h.Fill(rawconst_endc[ix][iy][sign]);
418  const_endc_h.Fill(newCalibs_[ee]);
419  oldconst_endc_h.Fill(oldCalibs_[ee]);
420  newvsraw_endc_h.Fill(rawconst_endc[ix][iy][sign],newCalibs_[ee]);
421 
422  if(sign==1){
423  endcapmapold_plus.Fill(ix+1,iy+1,oldCalibs_[ee]);
424  endcapmapnew_plus.Fill(ix+1,iy+1,newCalibs_[ee]);
425  endcapmapratio_plus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
426  }
427  else{
428  endcapmapold_minus.Fill(ix+1,iy+1,oldCalibs_[ee]);
429  endcapmapnew_minus.Fill(ix+1,iy+1,newCalibs_[ee]);
430  endcapmapratio_minus.Fill(ix+1,iy+1,newCalibs_[ee]/oldCalibs_[ee]);
431  }
432 
433  }//if
434  }//iy
435  }//ix
436 
437  } // sides
438 
439  barreletamap.Write();
440  barreletamapraw.Write();
441  rawconst_endc_h.Write();
442  const_endc_h.Write();
443  oldconst_endc_h.Write();
444  newvsraw_endc_h.Write();
445  barrelmapold.Write();
446  barrelmapnew.Write();
447  barrelmapratio.Write();
448  endcapmapold_plus.Write();
449  endcapmapnew_plus.Write();
450  endcapmapratio_plus.Write();
451  endcapmapold_minus.Write();
452  endcapmapnew_minus.Write();
453  endcapmapratio_minus.Write();
454 
455  f.Close();
456 }
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
static const int kSides
static const int kBarlWedges
static const int kEndcWedgesX
double f[11][100]
float rawconst_barl[kBarlRings][kBarlWedges][kSides]
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
EcalIntercalibConstants newCalibs_
calib constants that we are going to calculate
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
float rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2_SM::fillHistos ( )

Definition at line 468 of file PhiSymmetryCalibration_step2_SM.cc.

References jets_cff::area, f, objects.autophobj::float, createfilelist::int, kBarlRings, kBarlWedges, kEndcEtaRings, kEndcWedgesX, kEndcWedgesY, kSides, relativeConstraints::ring, Validation_hcalonly_cfi::sign, and lumiQTWidget::t.

469 {
470  TFile f("PhiSymmetryCalibration.root","recreate");
471 
472  std::vector<TH1F*> etsum_barl_histos(kBarlRings);
473  std::vector<TH1F*> esum_barl_histos(kBarlRings);
474 
475  // determine ranges of ET sums to get histo bounds and book histos (barrel)
476  for (int ieta=0; ieta<kBarlRings; ieta++) {
477  float low=999999.;
478  float high=0.;
479  float low_e=999999.;
480  float high_e=0.;
481 
482  for (int iphi=0; iphi<kBarlWedges; iphi++) {
483  for (int sign=0; sign<kSides; sign++) {
484  float etsum = etsum_barl_[ieta][iphi][sign];
485  if (etsum<low && etsum!=0.) low=etsum;
486  if (etsum>high) high=etsum;
487 
488  float esum = esum_barl_[ieta][iphi][sign];
489  if (esum<low_e && esum!=0.) low_e=esum;
490  if (esum>high_e) high_e=esum;
491  }
492  }
493 
494  ostringstream t;
495  t << "etsum_barl_" << ieta+1;
496  etsum_barl_histos[ieta]=new TH1F(t.str().c_str(),"",50,low-.2*low,high+.1*high);
497  t.str("");
498 
499  t << "esum_barl_" << ieta+1;
500  esum_barl_histos[ieta]=new TH1F(t.str().c_str(),"",50,low_e-.2*low_e,high_e+.1*high_e);
501  t.str("");
502 
503  // fill barrel ET sum histos
504  etsumMean_barl_[ieta]=0.;
505  esumMean_barl_[ieta]=0.;
506 
507  for (int iphi=0; iphi<kBarlWedges; iphi++) {
508  for (int sign=0; sign<kSides; sign++) {
509 
510  // mean for the SC
511  int iphi_r = int(iphi/nscx);
512 
513  if( !(iphi%nscx)){
514  // bad channel correction
515  etsum_barl_SM_[ieta][iphi_r][sign] = etsum_barl_SM_[ieta][iphi_r][sign]*nscx/(nscx- nBads_barl_SM_[ieta][iphi_r][sign]);
516 // std::cout << "ETSUM M " << ieta << " " << iphi_r << " " <<
517 // sign << " " << etsum_barl_SM_[ieta][iphi_r][sign] << " " << nBads_barl_SM_[ieta][iphi_r][sign]<< endl;
518  etsumMean_barl_SM_[ieta] +=
519  etsum_barl_SM_[ieta][iphi_r][sign]/(2*int(kBarlWedges/nscx));
520  }
521  if(e_.goodCell_barl[ieta][iphi][sign]){
522  float etsum = etsum_barl_[ieta][iphi][sign];
523  float esum = esum_barl_[ieta][iphi][sign];
524  etsum_barl_histos[ieta]->Fill(etsum);
525  esum_barl_histos[ieta]->Fill(esum);
526  etsumMean_barl_[ieta]+=etsum;
527 
528 
529  esumMean_barl_[ieta]+=esum;
530  }
531  }
532  }
533 
534  etsum_barl_histos[ieta]->Write();
535  esum_barl_histos[ieta]->Write();
536  etsumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
537  esumMean_barl_[ieta]/=(720.-e_.nBads_barl[ieta]);
538 
539  delete etsum_barl_histos[ieta];
540  delete esum_barl_histos[ieta]; //VS
541  }
542 
543  std::vector<TH1F*> etsum_endc_histos(kEndcEtaRings);
544  std::vector<TH1F*> etsum_endc_uncorr_histos(kEndcEtaRings);
545  std::vector<TH1F*> esum_endc_histos(kEndcEtaRings);
546 
547  std::vector<TH2F*> etsumvsarea_endc_histos(kEndcEtaRings);
548  std::vector<TH2F*> esumvsarea_endc_histos(kEndcEtaRings);
549 
550  // determine ranges of ET sums to get histo bounds and book histos (endcap)
551  for (int ring=0; ring<kEndcEtaRings; ring++) {
552 
553  float low=FLT_MAX;
554  float low_uncorr=FLT_MAX;
555  float high=0.;
556  float high_uncorr=0;
557  float low_e=FLT_MAX;
558  float high_e=0.;
559  float low_a=1.;
560  float high_a=0.;
561  for (int ix=0; ix<kEndcWedgesX; ix++) {
562  for (int iy=0; iy<kEndcWedgesY; iy++) {
563  if (e_.endcapRing_[ix][iy]==ring) {
564  for (int sign=0; sign<kSides; sign++) {
565  float etsum = etsum_endc_[ix][iy][sign];
566  if (etsum<low && etsum!=0.) low=etsum;
567  if (etsum>high) high=etsum;
568 
569  float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
570  if (etsum_uncorr<low_uncorr && etsum_uncorr!=0.) low_uncorr=etsum_uncorr;
571  if (etsum_uncorr>high_uncorr) high_uncorr=etsum_uncorr;
572 
573  float esum = esum_endc_[ix][iy][sign];
574  if (esum<low_e && esum!=0.) low_e=esum;
575  if (esum>high_e) high_e=esum;
576 
577  float area = e_.cellArea_[ix][iy];
578  if (area<low_a) low_a=area;
579  if (area>high_a) high_a=area;
580  }
581  }
582  }
583  }
584 
585  ostringstream t;
586  t<<"etsum_endc_" << ring+1;
587  etsum_endc_histos[ring]= new TH1F(t.str().c_str(),"",50,low-.2*low,high+.1*high);
588  t.str("");
589 
590  t<<"etsum_endc_uncorr_" << ring+1;
591  etsum_endc_uncorr_histos[ring]= new TH1F(t.str().c_str(),"",50,low_uncorr-.2*low_uncorr,high_uncorr+.1*high_uncorr);
592  t.str("");
593 
594  t<<"esum_endc_" << ring+1;
595  esum_endc_histos[ring]= new TH1F(t.str().c_str(),"",50,low_e-.2*low_e,high_e+.1*high_e);
596  t.str("");
597 
598  t<<"etsumvsarea_endc_" << ring+1;
599  etsumvsarea_endc_histos[ring]= new TH2F(t.str().c_str(),";A_{#eta#phi};#Sigma E_{T}",50,low_a,high_a,50,low,high);
600  t.str("");
601 
602  t<<"esumvsarea_endc_" << ring+1;
603  esumvsarea_endc_histos[ring]= new TH2F(t.str().c_str(),";A_{#eta#phi};#Sigma E",50,low_a,high_a,50,low_e,high_e);
604  t.str("");
605 
606  // fill endcap ET sum histos
607  etsumMean_endc_[ring]=0.;
608  esumMean_endc_[ring]=0.;
609  for (int ix=0; ix<kEndcWedgesX; ix++) {
610  for (int iy=0; iy<kEndcWedgesY; iy++) {
611  if (e_.endcapRing_[ix][iy]==ring) {
612  for (int sign=0; sign<kSides; sign++) {
613  if(e_.goodCell_endc[ix][iy][sign]){
614  float etsum = etsum_endc_[ix][iy][sign];
615  float esum = esum_endc_[ix][iy][sign];
616  float etsum_uncorr = etsum_endc_uncorr[ix][iy][sign];
617  etsum_endc_histos[ring]->Fill(etsum);
618  etsum_endc_uncorr_histos[ring]->Fill(etsum_uncorr);
619  esum_endc_histos[ring]->Fill(esum);
620 
621  float area = e_.cellArea_[ix][iy];
622  etsumvsarea_endc_histos[ring]->Fill(area,etsum);
623  esumvsarea_endc_histos[ring]->Fill(area,esum);
624 
625  etsumMean_endc_[ring]+=etsum;
626  esumMean_endc_[ring]+=esum;
627  }
628  }
629  }
630  }
631  }
632 
633  etsum_endc_histos[ring]->Write();
634  etsum_endc_uncorr_histos[ring]->Write();
635  esum_endc_histos[ring]->Write();
636  etsumMean_endc_[ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
637  esumMean_endc_[ring]/=(float(e_.nRing_[ring]*2-e_.nBads_endc[ring]));
638  etsumvsarea_endc_histos[ring]->Write();
639  esumvsarea_endc_histos[ring]->Write();
640 
641  delete etsum_endc_histos[ring];
642  delete etsum_endc_uncorr_histos[ring];
643  delete esum_endc_histos[ring];
644  delete etsumvsarea_endc_histos[ring];
645  delete esumvsarea_endc_histos[ring];
646  }//ring
647 
648 
649  // Maps of etsum in EB and EE
650  TH2F barreletamap("barreletamap","barreletamap",171, -85,86,100,0,2);
651  TH2F barrelmap("barrelmap","barrelmap - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{0}}",360,1,360, 171, -85,86);
652  TH2F barrelmap_e("barrelmape","barrelmape - #frac{#Sigma E}{<#Sigma E>_{0}}",360,1,360, 171, -85,86);
653  TH2F barrelmap_divided("barrelmapdiv","barrelmapdivided - #frac{#Sigma E_{T}}{hits}",360,1,360,171,-85,86);
654  TH2F barrelmap_e_divided("barrelmapediv","barrelmapedivided - #frac{#Sigma E}{hits}",360,1,360,171,-85,86);
655  TH2F endcmap_plus_corr("endcapmapplus_corrected","endcapmapplus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
656  TH2F endcmap_minus_corr("endcapmapminus_corrected","endcapmapminus - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
657  TH2F endcmap_plus_uncorr("endcapmapplus_uncorrected","endcapmapplus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
658  TH2F endcmap_minus_uncorr("endcapmapminus_uncorrected","endcapmapminus_uncor - #frac{#Sigma E_{T}}{<#Sigma E_{T}>_{38}}",100,1,101,100,1,101);
659  TH2F endcmap_e_plus("endcapmapeplus","endcapmapeplus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
660  TH2F endcmap_e_minus("endcapmapeminus","endcapmapeminus - #frac{#Sigma E}{<#Sigma E>_{38}}",100,1,101,100,1,101);
661 
662  for (int sign=0; sign<kSides; sign++) {
663 
664  int thesign = sign==1 ? 1:-1;
665 
666  for (int ieta=0; ieta<kBarlRings; ieta++) {
667  for (int iphi=0; iphi<kBarlWedges; iphi++) {
668  if(e_.goodCell_barl[ieta][iphi][sign]){
669  barrelmap.Fill(iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
670  barrelmap_e.Fill(iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/esumMean_barl_[0]); //VS
671  if (!nhits_barl_[ieta][iphi][sign]) nhits_barl_[ieta][iphi][sign] =1;
672  barrelmap_divided.Fill( iphi+1,ieta*thesign + thesign, etsum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]);
673  barrelmap_e_divided.Fill( iphi+1,ieta*thesign + thesign, esum_barl_[ieta][iphi][sign]/nhits_barl_[ieta][iphi][sign]); //VS
674  //int mod20= (iphi+1)%20;
675  //if (mod20==0 || mod20==1 ||mod20==2) continue; // exclude SM boundaries
676  barreletamap.Fill(ieta*thesign + thesign,etsum_barl_[ieta][iphi][sign]/etsumMean_barl_[0]);
677  }//if
678  }//iphi
679  }//ieta
680 
681  for (int ix=0; ix<kEndcWedgesX; ix++) {
682  for (int iy=0; iy<kEndcWedgesY; iy++) {
683  if (sign==1) {
684  endcmap_plus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
685  endcmap_plus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
686  endcmap_e_plus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
687  }
688  else{
689  endcmap_minus_corr.Fill(ix+1,iy+1,etsum_endc_[ix][iy][sign]/etsumMean_endc_[38]);
690  endcmap_minus_uncorr.Fill(ix+1,iy+1,etsum_endc_uncorr[ix][iy][sign]/etsumMean_endc_[38]);
691  endcmap_e_minus.Fill(ix+1,iy+1,esum_endc_[ix][iy][sign]/esumMean_endc_[38]);
692  }
693  }//iy
694  }//ix
695 
696  } //sign
697 
698 
699 
700  barreletamap.Write();
701  barrelmap_divided.Write();
702  barrelmap.Write();
703  barrelmap_e_divided.Write();
704  barrelmap_e.Write();
705  endcmap_plus_corr.Write();
706  endcmap_minus_corr.Write();
707  endcmap_plus_uncorr.Write();
708  endcmap_minus_uncorr.Write();
709  endcmap_e_plus.Write();
710  endcmap_e_minus.Write();
711 
712 
713  vector<TH1F*> etavsphi_endc(kEndcEtaRings);
714  vector<TH1F*> areavsphi_endc(kEndcEtaRings);
715  vector<TH1F*> etsumvsphi_endcp_corr(kEndcEtaRings);
716  vector<TH1F*> etsumvsphi_endcm_corr(kEndcEtaRings);
717  vector<TH1F*> etsumvsphi_endcp_uncorr(kEndcEtaRings);
718  vector<TH1F*> etsumvsphi_endcm_uncorr(kEndcEtaRings);
719  vector<TH1F*> esumvsphi_endcp(kEndcEtaRings);
720  vector<TH1F*> esumvsphi_endcm(kEndcEtaRings);
721 
722  std::vector<TH1F*> deltaeta_histos(kEndcEtaRings);
723  std::vector<TH1F*> deltaphi_histos(kEndcEtaRings);
724 
725  for(int ring =0; ring<kEndcEtaRings;++ring){
726 
727  ostringstream t;
728  t<< "etavsphi_endc_"<<ring;
729  etavsphi_endc[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
730  t.str("");
731 
732  t<< "areavsphi_endc_"<<ring;
733  areavsphi_endc[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
734  t.str("");
735 
736  t<< "etsumvsphi_endcp_corr_"<<ring;
737  etsumvsphi_endcp_corr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
738  t.str("");
739 
740  t << "etsumvsphi_endcm_corr_"<<ring;
741  etsumvsphi_endcm_corr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
742  t.str("");
743 
744  t << "etsumvsphi_endcp_uncorr_"<<ring;
745  etsumvsphi_endcp_uncorr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
746  t.str("");
747 
748  t << "etsumvsphi_endcm_uncorr_"<<ring;
749  etsumvsphi_endcm_uncorr[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
750  t.str("");
751 
752  t << "esumvsphi_endcp_"<<ring;
753  esumvsphi_endcp[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
754  t.str("");
755 
756  t << "esumvsphi_endcm_"<<ring;
757  esumvsphi_endcm[ring] = new TH1F(t.str().c_str(), t.str().c_str(),e_.nRing_[ring],0,e_.nRing_[ring]);
758  t.str("");
759 
760  t << "deltaeta_" << ring;
761  deltaeta_histos[ring]= new TH1F(t.str().c_str(),"",50,-.1,.1);
762  t.str("");
763  t << "deltaphi_" << ring;
764  deltaphi_histos[ring]= new TH1F(t.str().c_str(),"",50,-.1,.1);
765  t.str("");
766  }
767 
768  for (int ix=0; ix<kEndcWedgesX; ix++) {
769  for (int iy=0; iy<kEndcWedgesY; iy++) {
770 
771  int ring = e_.endcapRing_[ix][iy];
772  if (ring!=-1) {
773  int iphi_endc=-1;
774  for (int ip=0; ip<e_.nRing_[ring]; ip++) {
775  if (e_.cellPhi_[ix][iy]==e_.phi_endc_[ip][ring]) iphi_endc=ip;
776  }
777 
778  if(iphi_endc!=-1){
779  for (int sign=0; sign<kSides; sign++) {
780  if(e_.goodCell_endc[ix][iy][sign]){
781  if (sign==1){
782  etsumvsphi_endcp_corr[ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
783  etsumvsphi_endcp_uncorr[ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
784  esumvsphi_endcp[ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
785  } else {
786  etsumvsphi_endcm_corr[ring]->Fill(iphi_endc,etsum_endc_[ix][iy][sign]);
787  etsumvsphi_endcm_uncorr[ring]->Fill(iphi_endc,etsum_endc_uncorr[ix][iy][sign]);
788  esumvsphi_endcm[ring]->Fill(iphi_endc,esum_endc_[ix][iy][sign]);
789  }
790  }//if
791  }//sign
792  etavsphi_endc[ring]->Fill(iphi_endc,e_.cellPos_[ix][iy].eta());
793  areavsphi_endc[ring]->Fill(iphi_endc,e_.cellArea_[ix][iy]);
794  } //if iphi_endc
795 
796  }//if ring
797  }//iy
798  } //ix
799 
800 
801 
802  for(int ring =0; ring<kEndcEtaRings;++ring){
803 
804  etavsphi_endc[ring]->Write();
805  areavsphi_endc[ring]->Write();
806  etsumvsphi_endcp_corr[ring]->Write();
807  etsumvsphi_endcm_corr[ring]->Write();
808  etsumvsphi_endcp_uncorr[ring]->Write();
809  etsumvsphi_endcm_uncorr[ring]->Write();
810  esumvsphi_endcp[ring]->Write();
811  esumvsphi_endcm[ring]->Write();
812  deltaeta_histos[ring]->Write();
813  deltaphi_histos[ring]->Write();
814 
815 
816  delete etsumvsphi_endcp_corr[ring];
817  delete etsumvsphi_endcm_corr[ring];
818  delete etsumvsphi_endcp_uncorr[ring];
819  delete etsumvsphi_endcm_uncorr[ring];
820  delete etavsphi_endc[ring];
821  delete areavsphi_endc[ring];
822  delete esumvsphi_endcp[ring];
823  delete esumvsphi_endcm[ring];
824  delete deltaeta_histos[ring];
825  delete deltaphi_histos[ring];
826  }
827 
828 
829  f.Close();
830 }
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
int nRing_[kEndcEtaRings]
int nBads_endc[kEndcEtaRings]
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
GlobalPoint cellPos_[kEndcWedgesX][kEndcWedgesY]
double etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kSides
int nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
double phi_endc_[kMaxEndciPhi][kEndcEtaRings]
static const int kBarlWedges
static const int kEndcWedgesX
int endcapRing_[kEndcWedgesX][kEndcWedgesY]
static const int kEndcEtaRings
double f[11][100]
double esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double cellPhi_[kEndcWedgesX][kEndcWedgesY]
T eta() const
Definition: PV3DBase.h:76
double cellArea_[kEndcWedgesX][kEndcWedgesY]
double etsum_endc_uncorr[kEndcWedgesX][kEndcWedgesX][kSides]
double esum_barl_[kBarlRings][kBarlWedges][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
int nBads_barl[kBarlRings]
bool goodCell_endc[kEndcWedgesX][kEndcWedgesX][kSides]
static const int kEndcWedgesY
void PhiSymmetryCalibration_step2_SM::outResidHistos ( )

Definition at line 912 of file PhiSymmetryCalibration_step2_SM.cc.

References f, and relativeConstraints::ring.

912  {
913 
914  // output histograms of residual miscalibrations
915  TFile f("PhiSymmetryCalibration_miscal_resid.root","recreate");
916  for (int ieta=0; ieta<85; ieta++) {
917  miscal_resid_barl_histos[ieta]->Write();
918  correl_barl_histos[ieta]->Write();
919 
920  delete miscal_resid_barl_histos[ieta];
921  delete correl_barl_histos[ieta];
922  }
923 
924  for (int ring=0; ring<39; ring++) {
925  miscal_resid_endc_histos[ring]->Write();
926  correl_endc_histos[ring]->Write();
927 
929  delete correl_endc_histos[ring];
930 
931  }
932  f.Close();
933 }
double f[11][100]
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos
void PhiSymmetryCalibration_step2_SM::readEtSums ( )

Definition at line 833 of file PhiSymmetryCalibration_step2_SM.cc.

References recoMuon::in, createfilelist::int, kBarlRings, kEndcEtaRings, nhits, relativeConstraints::ring, and Validation_hcalonly_cfi::sign.

833  {
834 
835 
836  //read in ET sums
837 
838  int ieta,iphi,sign,ix,iy,dummy;
839  double etsum;
840  unsigned int nhits;
841  std::ifstream etsum_barl_in("etsum_barl.dat", ios::in);
842  while ( etsum_barl_in >> dummy >> ieta >> iphi >> sign >> etsum >> nhits ) {
843  etsum_barl_[ieta][iphi][sign]+=etsum;
844  nhits_barl_[ieta][iphi][sign]+=nhits;
845 
846  // fill etsums for the SM calibration
847  int iphi_r = int(iphi/nscx);
848  etsum_barl_SM_[ieta][iphi_r][sign]+= etsum;
849 // etsum*nscx/(nscx- nBads_barl_SM_[ieta][iphi_r][sign]);
850  // if(nBads_barl_SM_[ieta][iphi_r][sign]>0){
851  // std::cout << "ETSUM" << etsum_barl_SM_[ieta][iphi_r][sign] << " " << nscx << " " << nBads_barl_SM_[ieta][iphi_r][sign]<< endl;
852  // }
853  }
854 
855  std::ifstream etsum_endc_in("etsum_endc.dat", ios::in);
856  while ( etsum_endc_in >> dummy >> ix >> iy >> sign >> etsum >> nhits>>dummy ) {
857  etsum_endc_[ix][iy][sign]+=etsum;
858  nhits_endc_[ix][iy][sign]+=nhits;
859 
860  }
861 
862  std::ifstream k_barl_in("k_barl.dat", ios::in);
863  for (int ieta=0; ieta<kBarlRings; ieta++) {
864  k_barl_in >> dummy >> k_barl_[ieta];
865  }
866 
867  std::ifstream k_endc_in("k_endc.dat", ios::in);
868  for (int ring=0; ring<kEndcEtaRings; ring++) {
869  k_endc_in >> dummy >> k_endc_[ring];
870  }
871 
872 
873 }
double etsum_barl_[kBarlRings][kBarlWedges][kSides]
static const int kBarlRings
unsigned int nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
double etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static const int kEndcEtaRings
double etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
unsigned int nhits_barl_[kBarlRings][kBarlWedges][kSides]
void PhiSymmetryCalibration_step2_SM::setUp ( const edm::EventSetup setup)

if a miscalibration was applied, load it, if not put it to 1

Definition at line 51 of file PhiSymmetryCalibration_step2_SM.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), CaloGeometry::getValidDetIds(), h, createfilelist::int, kBarlRings, kBarlWedges, kSides, AlCaHLTBitMon_ParallelJobs::p, callgraph::path, EcalFloatCondObjectContainerXMLTranslator::readXML(), and Validation_hcalonly_cfi::sign.

51  {
52 
54  se.get<EcalChannelStatusRcd>().get(chStatus);
55 
57  se.get<CaloGeometryRecord>().get(geoHandle);
58 
61 
62  e_.setup(&(*geoHandle), &(*chStatus), statusThreshold_);
63 
64 
65 
66  for (int sign=0; sign<kSides; sign++) {
67  for (int ieta=0; ieta<kBarlRings; ieta++) {
68  for (int iphi=0; iphi<kBarlWedges; iphi++) {
69  int iphi_r=int(iphi/nscx);
70  if( !e_.goodCell_barl[ieta][iphi][sign] ){
71  nBads_barl_SM_[ieta][iphi_r][sign]++;
72  // std::cout << "N BAD CELL " << nBads_barl_SM_[ieta][iphi_r][sign] << endl;
73  }
74  }
75  }
76  }
77 
78 
79 
82 
84  namespace fs = boost::filesystem;
86  if (!fs::exists(p)) edm::LogError("PhiSym") << "File not found: "
87  << initialmiscalibfile_ <<endl;
88 
89  int ret=
91  if (ret) edm::LogError("PhiSym")<<"Error reading XML files"<<endl;
92  } else {
93 
94  for (vector<DetId>::iterator it=barrelCells.begin(); it!=barrelCells.end(); ++it){
95  miscalib_[*it]=1;
96  }
97 
98  for (vector<DetId>::iterator it=endcapCells.begin(); it!=endcapCells.end(); ++it){
99  miscalib_[*it]=1;
100 
101  }
102  }
103 
104  // if we are reiterating, read constants from previous iter
105  // if not put them to one
106  if (reiteration_){
107 
108 
110  namespace fs = boost::filesystem;
111  fs::path p(oldcalibfile_.c_str());
112  if (!fs::exists(p)) edm::LogError("PhiSym") << "File not found: "
113  << oldcalibfile_ <<endl;
114 
115  int ret=
117  oldCalibs_);
118 
119  if (ret) edm::LogError("PhiSym")<<"Error reading XML files"<<endl;;
120 
121  } else {
122 
123  for (vector<DetId>::iterator it=barrelCells.begin();
124  it!=barrelCells.end(); ++it)
125  oldCalibs_[*it]=1;
126 
127 
128  for (vector<DetId>::iterator it=endcapCells.begin();
129  it!=endcapCells.end(); ++it)
130  oldCalibs_[*it]=1;
131 
132 
133  } // else
134 
135 }
void setup(const CaloGeometry *geometry, const EcalChannelStatus *chstatus, int statusThreshold)
EcalIntercalibConstants miscalib_
initial miscalibration applied if any)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
static const int kBarlRings
bool goodCell_barl[kBarlRings][kBarlWedges][kSides]
static const int kSides
int nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
static const int kBarlWedges
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
EcalIntercalibConstants oldCalibs_
the old calibration constants (when reiterating, the last ones derived)
void PhiSymmetryCalibration_step2_SM::setupResidHistos ( )

Definition at line 877 of file PhiSymmetryCalibration_step2_SM.cc.

References kBarlRings, kEndcEtaRings, and relativeConstraints::ring.

877  {
878 
881 
882 
883  for (int ieta=0; ieta<kBarlRings; ieta++) {
884  ostringstream t1;
885  t1<<"mr_barl_"<<ieta+1;
886  miscal_resid_barl_histos[ieta] = new TH1F(t1.str().c_str(),"",100,0.,2.);
887  ostringstream t2;
888  t2<<"co_barl_"<<ieta+1;
889  correl_barl_histos[ieta] = new TH2F(t2.str().c_str(),"",50,.5,1.5,50,.5,1.5);
890  }
891 
894 
895 
896  for (int ring=0; ring<kEndcEtaRings; ring++) {
897  ostringstream t1;
898  t1<<"mr_endc_"<< ring+1;
899  miscal_resid_endc_histos[ring] = new TH1F(t1.str().c_str(),"",100,0.,2.);
900  ostringstream t2;
901  t2<<"co_endc_"<<ring+1;
902  correl_endc_histos[ring] = new TH2F(t2.str().c_str(),"",50,.5,1.5,50,.5,1.5);
903  }
904 
905 
906 
907 
908 
909 }
static const int kBarlRings
static const int kEndcEtaRings
std::vector< TH1F * > miscal_resid_barl_histos
res miscalib histos

Member Data Documentation

std::vector<DetId> PhiSymmetryCalibration_step2_SM::barrelCells
private

Definition at line 79 of file PhiSymmetryCalibration_step2_SM.h.

std::vector<TH2F*> PhiSymmetryCalibration_step2_SM::correl_barl_histos
private

Definition at line 106 of file PhiSymmetryCalibration_step2_SM.h.

std::vector<TH2F*> PhiSymmetryCalibration_step2_SM::correl_endc_histos
private

Definition at line 109 of file PhiSymmetryCalibration_step2_SM.h.

EcalGeomPhiSymHelper PhiSymmetryCalibration_step2_SM::e_
private

Definition at line 77 of file PhiSymmetryCalibration_step2_SM.h.

std::vector<DetId> PhiSymmetryCalibration_step2_SM::endcapCells
private

Definition at line 80 of file PhiSymmetryCalibration_step2_SM.h.

float PhiSymmetryCalibration_step2_SM::epsilon_M_barl[kBarlRings][kBarlWedges][kSides]
private

Definition at line 74 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::epsilon_M_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
private

Definition at line 48 of file PhiSymmetryCalibration_step2_SM.h.

float PhiSymmetryCalibration_step2_SM::epsilon_M_endc[kEndcWedgesX][kEndcWedgesY][kSides]
private

Definition at line 75 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::esum_barl_[kBarlRings][kBarlWedges][kSides]
private

Definition at line 59 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::esum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 60 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::esumMean_barl_[kBarlRings]
private

Definition at line 62 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::esumMean_endc_[kEndcEtaRings]
private

Definition at line 63 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsum_barl_[kBarlRings][kBarlWedges][kSides]
private

Definition at line 40 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsum_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
private

Definition at line 45 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsum_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 50 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsum_endc_uncorr[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 51 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsumMean_barl_[kBarlRings]
private

Definition at line 52 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsumMean_barl_SM_[kBarlRings]
private

Definition at line 47 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::etsumMean_endc_[kEndcEtaRings]
private

Definition at line 53 of file PhiSymmetryCalibration_step2_SM.h.

bool PhiSymmetryCalibration_step2_SM::firstpass_
private

Definition at line 82 of file PhiSymmetryCalibration_step2_SM.h.

bool PhiSymmetryCalibration_step2_SM::have_initial_miscalib_
private

Definition at line 100 of file PhiSymmetryCalibration_step2_SM.h.

std::string PhiSymmetryCalibration_step2_SM::initialmiscalibfile_
private

Definition at line 101 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::k_barl_[kBarlRings]
private

Definition at line 65 of file PhiSymmetryCalibration_step2_SM.h.

double PhiSymmetryCalibration_step2_SM::k_endc_[kEndcEtaRings]
private

Definition at line 66 of file PhiSymmetryCalibration_step2_SM.h.

std::vector<TH1F*> PhiSymmetryCalibration_step2_SM::miscal_resid_barl_histos
private

res miscalib histos

Definition at line 105 of file PhiSymmetryCalibration_step2_SM.h.

std::vector<TH1F*> PhiSymmetryCalibration_step2_SM::miscal_resid_endc_histos
private

Definition at line 108 of file PhiSymmetryCalibration_step2_SM.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2_SM::miscalib_
private

initial miscalibration applied if any)

Definition at line 97 of file PhiSymmetryCalibration_step2_SM.h.

int PhiSymmetryCalibration_step2_SM::nBads_barl_SM_[kBarlRings][int(kBarlWedges/nscx)][kSides]
private

Definition at line 46 of file PhiSymmetryCalibration_step2_SM.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2_SM::newCalibs_
private

calib constants that we are going to calculate

Definition at line 93 of file PhiSymmetryCalibration_step2_SM.h.

unsigned int PhiSymmetryCalibration_step2_SM::nhits_barl_[kBarlRings][kBarlWedges][kSides]
private

Definition at line 55 of file PhiSymmetryCalibration_step2_SM.h.

unsigned int PhiSymmetryCalibration_step2_SM::nhits_endc_[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 56 of file PhiSymmetryCalibration_step2_SM.h.

const int PhiSymmetryCalibration_step2_SM::nscx =20
staticprivate

Definition at line 44 of file PhiSymmetryCalibration_step2_SM.h.

std::string PhiSymmetryCalibration_step2_SM::oldcalibfile_
private

Definition at line 87 of file PhiSymmetryCalibration_step2_SM.h.

EcalIntercalibConstants PhiSymmetryCalibration_step2_SM::oldCalibs_
private

the old calibration constants (when reiterating, the last ones derived)

Definition at line 90 of file PhiSymmetryCalibration_step2_SM.h.

float PhiSymmetryCalibration_step2_SM::rawconst_barl[kBarlRings][kBarlWedges][kSides]
private

Definition at line 69 of file PhiSymmetryCalibration_step2_SM.h.

float PhiSymmetryCalibration_step2_SM::rawconst_endc[kEndcWedgesX][kEndcWedgesX][kSides]
private

Definition at line 70 of file PhiSymmetryCalibration_step2_SM.h.

bool PhiSymmetryCalibration_step2_SM::reiteration_
private

Definition at line 86 of file PhiSymmetryCalibration_step2_SM.h.

int PhiSymmetryCalibration_step2_SM::statusThreshold_
private

Definition at line 83 of file PhiSymmetryCalibration_step2_SM.h.