CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripHitEffFromCalibTree Class Reference
Inheritance diagram for SiStripHitEffFromCalibTree:
ConditionDBWriter< SiStripBadStrip > edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripHitEffFromCalibTree (const edm::ParameterSet &)
 
 ~SiStripHitEffFromCalibTree ()
 
- Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
virtual ~ConditionDBWriter ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- 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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void algoAnalyze (const edm::Event &e, const edm::EventSetup &c) override
 
virtual void algoBeginJob ()
 
virtual void algoEndJob () override
 
float calcPhi (float x, float y)
 
void ComputeEff (vector< TH1F * > &vhfound, vector< TH1F * > &vhtotal, string name)
 
TString GetLayerName (Long_t k)
 
TString GetLayerSideName (Long_t k)
 
SiStripBadStripgetNewObject () override
 
void makeHotColdMaps ()
 
void makeSQLite ()
 
void makeSummary ()
 
void makeSummaryVsBx ()
 
void makeSummaryVsCM ()
 
void makeSummaryVsLumi ()
 
void makeTKMap ()
 
void SetBadComponents (int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
 
void totalStatistics ()
 

Private Attributes

string _badModulesFile
 
unsigned int _bunchx
 
unsigned int _clusterMatchingMethod
 
float _clusterTrajDist
 
float _effPlotMin
 
float _ResXSig
 
bool _showEndcapSides
 
bool _showOnlyGoodModules
 
bool _showRings
 
bool _showTOB6TEC9
 
unsigned int _spaceBetweenTrains
 
float _stripsApvEdge
 
TString _title
 
float _tkMapMin
 
bool _useCM
 
int alllayerfound [35]
 
int alllayertotal [35]
 
map< unsigned int, double > BadModules
 
TTree * CalibTree
 
vector< string > CalibTreeFilenames
 
unsigned int doSummary
 
edm::FileInPath FileInPath_
 
edm::Service< TFileServicefs
 
int goodlayerfound [35]
 
int goodlayertotal [35]
 
vector< hithits [23]
 
vector< TH2F * > HotColdMaps
 
int layerfound [23]
 
map< unsigned int, vector< int > > layerfound_perBx
 
vector< TH1F * > layerfound_vsCM
 
vector< TH1F * > layerfound_vsLumi
 
vector< TH1F * > layerfound_vsPU
 
int layertotal [23]
 
map< unsigned int, vector< int > > layertotal_perBx
 
vector< TH1F * > layertotal_vsCM
 
vector< TH1F * > layertotal_vsLumi
 
vector< TH1F * > layertotal_vsPU
 
map< unsigned int, pair< unsigned int, unsigned int > > modCounter [23]
 
unsigned int nModsMin
 
unsigned int nTEClayers
 
SiStripQualityquality_
 
SiStripDetInfoFileReaderreader
 
float threshold
 
TrackerMaptkmap
 
TrackerMaptkmapbad
 
TrackerMaptkmapden
 
TrackerMaptkmapeff
 
TrackerMaptkmapnum
 

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 &)
 
- Protected Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
void setDoStore (const bool doStore)
 When set to false the payload will not be written to the db. More...
 
void storeOnDbNow ()
 
cond::Time_t timeOfLastIOV ()
 
- 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 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 93 of file SiStripHitEffFromCalibTree.cc.

Constructor & Destructor Documentation

SiStripHitEffFromCalibTree::SiStripHitEffFromCalibTree ( const edm::ParameterSet conf)
explicit

Definition at line 170 of file SiStripHitEffFromCalibTree.cc.

References _badModulesFile, _bunchx, _clusterMatchingMethod, _clusterTrajDist, _effPlotMin, _ResXSig, _showEndcapSides, _showOnlyGoodModules, _showRings, _showTOB6TEC9, _spaceBetweenTrains, _stripsApvEdge, _title, _tkMapMin, _useCM, CalibTreeFilenames, doSummary, FileInPath_, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), nModsMin, nTEClayers, quality_, reader, AlCaHLTBitMon_QueryRunRegistry::string, and threshold.

170  :
172  FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")
173 {
174  CalibTreeFilenames = conf.getUntrackedParameter<vector<std::string> >("CalibTreeFilenames");
175  threshold = conf.getParameter<double>("Threshold");
176  nModsMin = conf.getParameter<int>("nModsMin");
177  doSummary = conf.getParameter<int>("doSummary");
178  _badModulesFile = conf.getUntrackedParameter<std::string>("BadModulesFile", "");
179  _clusterMatchingMethod = conf.getUntrackedParameter<int>("ClusterMatchingMethod",0);
180  _ResXSig = conf.getUntrackedParameter<double>("ResXSig",-1);
181  _clusterTrajDist = conf.getUntrackedParameter<double>("ClusterTrajDist",64.0);
182  _stripsApvEdge = conf.getUntrackedParameter<double>("StripsApvEdge",10.0);
183  _bunchx = conf.getUntrackedParameter<int>("BunchCrossing",0);
184  _spaceBetweenTrains = conf.getUntrackedParameter<int>("SpaceBetweenTrains",25);
185  _useCM = conf.getUntrackedParameter<bool>("UseCommonMode",false);
186  _showEndcapSides = conf.getUntrackedParameter<bool>("ShowEndcapSides",true);
187  _showRings = conf.getUntrackedParameter<bool>("ShowRings",false);
188  _showTOB6TEC9 = conf.getUntrackedParameter<bool>("ShowTOB6TEC9",false);
189  _showOnlyGoodModules = conf.getUntrackedParameter<bool>("ShowOnlyGoodModules",false);
190  _tkMapMin = conf.getUntrackedParameter<double>("TkMapMin",0.9);
191  _effPlotMin = conf.getUntrackedParameter<double>("EffPlotMin",0.9);
192  _title = conf.getParameter<std::string>("Title");
194 
195  nTEClayers = 9; // number of wheels
196  if(_showRings) nTEClayers = 7; // number of rings
197 
198  quality_ = new SiStripQuality;
199 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
SiStripDetInfoFileReader * reader
std::string fullPath() const
Definition: FileInPath.cc:184
SiStripHitEffFromCalibTree::~SiStripHitEffFromCalibTree ( )

Definition at line 201 of file SiStripHitEffFromCalibTree.cc.

201 { }

Member Function Documentation

void SiStripHitEffFromCalibTree::algoAnalyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 213 of file SiStripHitEffFromCalibTree.cc.

References _badModulesFile, _bunchx, _clusterMatchingMethod, _clusterTrajDist, _ResXSig, _showRings, _showTOB6TEC9, _stripsApvEdge, _useCM, a, funct::abs(), accept(), alllayerfound, alllayertotal, Surface::bounds(), CalibTree, CalibTreeFilenames, gather_cfg::cout, SiStripBadStrip::decode(), end, edm::EventID::event(), fs, edm::EventSetup::get(), SiStripQuality::getBadComponentList(), SiStripBadStrip::getDataVectorBegin(), GetLayerName(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), goodlayerfound, goodlayertotal, hits, mps_fire::i, hcalTTPDigis_cfi::id, edm::EventBase::id(), hit::id, TrackerGeometry::idToDetUnit(), compare_using_db::ifile, muonGEMDigis_cfi::instLumi, createfilelist::int, gen::k, checklumidiff::l, layerfound_perBx, layerfound_vsCM, layerfound_vsLumi, layerfound_vsPU, layertotal_perBx, layertotal_vsCM, layertotal_vsLumi, layertotal_vsPU, geometryCSVtoXML::line, edm::EventBase::luminosityBlock(), TFileService::make(), makeHotColdMaps(), makeSQLite(), makeSummary(), makeSummaryVsBx(), makeSummaryVsCM(), makeSummaryVsLumi(), makeTKMap(), modCounter, mps_splice::mods, nModsMin, StripTopology::nstrips(), nTEClayers, metProducer_cfi::parameters, edm::ESHandle< T >::product(), JetPlusTrackCorrections_cff::PU, btvTracks_cfi::quality, quality_, SiStripBadStrip::data::range, reader, edm::EventID::run(), SetBadComponents(), StripGeomDetUnit::specificTopology(), harvestTrackValidationPlots::str, DetId::subdetId(), GeomDet::surface(), SiStripDetId::TEC, TrackerTopology::tecSide(), TrackerTopology::tecWheel(), threshold, SiStripDetId::TIB, TrackerTopology::tibLayer(), SiStripDetId::TID, TrackerTopology::tidSide(), TrackerTopology::tidWheel(), edm::EventBase::time(), SiStripDetId::TOB, TrackerTopology::tobLayer(), totalStatistics(), mixOne_simraw_on_sim_cfi::tracker, edm::Timestamp::value(), Bounds::width(), x, hit::x, y, hit::y, z, and hit::z.

213  {
214 
216  c.get<TrackerDigiGeometryRecord>().get( tracker );
217  const TrackerGeometry * tkgeom=&(* tracker);
218 
219  //Retrieve tracker topology from geometry
220  edm::ESHandle<TrackerTopology> tTopoHandle;
221  c.get<TrackerTopologyRcd>().get(tTopoHandle);
222  const TrackerTopology* const tTopo = tTopoHandle.product();
223 
224  // read bad modules to mask
225  ifstream badModules_file;
226  set<uint32_t> badModules_list;
227  if(_badModulesFile!="") {
228  badModules_file.open(_badModulesFile.c_str());
229  uint32_t badmodule_detid;
230  int mods, fiber1, fiber2, fiber3;
231  if(badModules_file.is_open()) {
232  string line;
233  while ( getline (badModules_file,line) ) {
234  if(badModules_file.eof()) continue;
235  stringstream ss(line);
236  ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
237  if(badmodule_detid!=0 && mods==1 && (fiber1==1 || fiber2==1 || fiber3==1) )
238  badModules_list.insert(badmodule_detid);
239  }
240  badModules_file.close();
241  }
242  }
243  if(badModules_list.size()) cout<<"Remove additionnal bad modules from the analysis: "<<endl;
244  set<uint32_t>::iterator itBadMod;
245  for (itBadMod=badModules_list.begin(); itBadMod!=badModules_list.end(); ++itBadMod)
246  cout<<" "<<*itBadMod<<endl;
247 
248 
249  // initialze counters and histos
250  for(int l=0; l < 35; l++) {
251  goodlayertotal[l] = 0;
252  goodlayerfound[l] = 0;
253  alllayertotal[l] = 0;
254  alllayerfound[l] = 0;
255  }
256 
257  TH1F* resolutionPlots[23];
258  for(Long_t ilayer = 0; ilayer <23; ilayer++) {
259  resolutionPlots[ilayer] = fs->make<TH1F>(Form("resol_layer_%i",(int)(ilayer)),GetLayerName(ilayer),125,-125,125);
260  resolutionPlots[ilayer]->GetXaxis()->SetTitle("trajX-clusX [strip unit]");
261 
262  layerfound_vsLumi.push_back( fs->make<TH1F>(Form("layerfound_vsLumi_layer_%i",(int)(ilayer)),GetLayerName(ilayer),60,0,15000));
263  layertotal_vsLumi.push_back( fs->make<TH1F>(Form("layertotal_vsLumi_layer_%i",(int)(ilayer)),GetLayerName(ilayer),60,0,15000));
264  layerfound_vsPU.push_back( fs->make<TH1F>(Form("layerfound_vsPU_layer_%i",(int)(ilayer)),GetLayerName(ilayer),30,0,60));
265  layertotal_vsPU.push_back( fs->make<TH1F>(Form("layertotal_vsPU_layer_%i",(int)(ilayer)),GetLayerName(ilayer),30,0,60));
266 
267  if(_useCM) {
268  layerfound_vsCM.push_back( fs->make<TH1F>(Form("layerfound_vsCM_layer_%i",(int)(ilayer)),GetLayerName(ilayer),20,0,400));
269  layertotal_vsCM.push_back( fs->make<TH1F>(Form("layertotal_vsCM_layer_%i",(int)(ilayer)),GetLayerName(ilayer),20,0,400));
270  }
271  }
272 
273  cout << "A module is bad if efficiency < " << threshold << " and has at least " << nModsMin << " nModsMin." << endl;
274 
275 
276  //Open the ROOT Calib Tree
277  for( unsigned int ifile=0; ifile < CalibTreeFilenames.size(); ifile++) {
278 
279  cout<<"Loading file: "<<CalibTreeFilenames[ifile]<<endl;
280  TFile* CalibTreeFile = TFile::Open(CalibTreeFilenames[ifile].c_str(),"READ");
281  CalibTreeFile->cd("anEff");
282  CalibTree = (TTree*)(gDirectory->Get("traj"));
283 
284  TLeaf* BadLf = CalibTree->GetLeaf("ModIsBad");
285  TLeaf* sistripLf = CalibTree->GetLeaf("SiStripQualBad");
286  TLeaf* idLf = CalibTree->GetLeaf("Id");
287  TLeaf* acceptLf = CalibTree->GetLeaf("withinAcceptance");
288  TLeaf* layerLf = CalibTree->GetLeaf("layer");
289  TLeaf* nHitsLf = CalibTree->GetLeaf("nHits");
290  TLeaf* xLf = CalibTree->GetLeaf("TrajGlbX");
291  TLeaf* yLf = CalibTree->GetLeaf("TrajGlbY");
292  TLeaf* zLf = CalibTree->GetLeaf("TrajGlbZ");
293  TLeaf* ResXSigLf = CalibTree->GetLeaf("ResXSig");
294  TLeaf* TrajLocXLf = CalibTree->GetLeaf("TrajLocX");
295  TLeaf* TrajLocYLf = CalibTree->GetLeaf("TrajLocY");
296  TLeaf* ClusterLocXLf = CalibTree->GetLeaf("ClusterLocX");
297  TLeaf* BunchLf = CalibTree->GetLeaf("bunchx");
298  TLeaf* InstLumiLf = CalibTree->GetLeaf("instLumi");
299  TLeaf* PULf = CalibTree->GetLeaf("PU");
300  TLeaf* CMLf = 0;
301  if(_useCM) CMLf = CalibTree->GetLeaf("commonMode");
302 
303  int nevents = CalibTree->GetEntries();
304  cout << "Successfully loaded analyze function with " << nevents << " events!\n";
305 
306 
307  //Loop through all of the events
308  for(int j =0; j < nevents; j++) {
309  CalibTree->GetEntry(j);
310  unsigned int isBad = (unsigned int)BadLf->GetValue();
311  unsigned int quality = (unsigned int)sistripLf->GetValue();
312  unsigned int id = (unsigned int)idLf->GetValue();
313  unsigned int accept = (unsigned int)acceptLf->GetValue();
314  unsigned int layer_wheel = (unsigned int)layerLf->GetValue();
315  unsigned int layer = layer_wheel;
316  if(_showRings && layer >10) { // use rings instead of wheels
317  if(layer<14) layer = 10 + ((id>>9)&0x3); //TID 3 disks and also 3 rings -> use the same container
318  else layer = 13 + ((id>>5)&0x7); //TEC
319  }
320  unsigned int nHits = (unsigned int)nHitsLf->GetValue();
321  double x = xLf->GetValue();
322  double y = yLf->GetValue();
323  double z = zLf->GetValue();
324  double resxsig = ResXSigLf->GetValue();
325  double TrajLocX = TrajLocXLf->GetValue();
326  double TrajLocY = TrajLocYLf->GetValue();
327  double ClusterLocX = ClusterLocXLf->GetValue();
328  double TrajLocXMid;
329  double stripTrajMid;
330  double stripCluster;
331  bool badquality = false;
332  unsigned int bx = (unsigned int)BunchLf->GetValue();
333  if(_bunchx > 0 && _bunchx != bx) continue;
334  double instLumi = 0;
335  if(InstLumiLf!=0) instLumi = InstLumiLf->GetValue();
336  double PU = 0;
337  if(PULf!=0) PU = PULf->GetValue();
338  int CM = -100;
339  if(_useCM) CM = CMLf->GetValue();
340 
341  //We have two things we want to do, both an XY color plot, and the efficiency measurement
342  //First, ignore anything that isn't in acceptance and isn't good quality
343 
344  //if(quality == 1 || accept != 1 || nHits < 8) continue;
345  if(accept != 1 || nHits < 8) continue;
346  if(quality == 1) badquality = true;
347 
348  // don't compute efficiencies in modules from TOB6 and TEC9
349  if(!_showTOB6TEC9 && (layer_wheel==10 || layer_wheel==22)) continue;
350 
351  // don't use bad modules given in the bad module list
352  itBadMod = badModules_list.find(id);
353  if(itBadMod!=badModules_list.end()) continue;
354 
355 
356  //Now that we have a good event, we need to look at if we expected it or not, and the location
357  //if we didn't
358  //Fill the missing hit information first
359  bool badflag = false;
360 
361  // By default uses the old matching method
362  if(_ResXSig < 0) {
363  if(isBad == 1) badflag = true; // isBad set to false in the tree when resxsig<999.0
364  }
365  else {
366  if(isBad == 1 || resxsig > _ResXSig) badflag = true;
367  }
368 
369  // Conversion of positions in strip unit
370  int nstrips = -9;
371  float Pitch = -9.0;
372 
373  if (resxsig==1000.0) { // special treatment, no GeomDetUnit associated in some cases when no cluster found
374  Pitch = 0.0205; // maximum
375  nstrips = 768; // maximum
376  stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ;
377  stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
378  }
379  else {
380  DetId ClusterDetId(id);
381  const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId);
382  const StripTopology& Topo = stripdet->specificTopology();
383  nstrips = Topo.nstrips();
384  Pitch = stripdet->surface().bounds().width() / Topo.nstrips();
385  stripTrajMid = TrajLocX/Pitch + nstrips/2.0 ; //layer01->10
386  stripCluster = ClusterLocX/Pitch + nstrips/2.0 ;
387 
388  // For trapezoidal modules: extrapolation of x trajectory position to the y middle of the module
389  // for correct comparison with cluster position
390  float hbedge = 0;
391  float htedge = 0;
392  float hapoth = 0;
393  if(layer>=11) {
394  const BoundPlane plane = stripdet->surface();
395  const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
396  std::array<const float, 4> const & parameters = (*trapezoidalBounds).parameters();
397  hbedge = parameters[0];
398  htedge = parameters[1];
399  hapoth = parameters[3];
400  TrajLocXMid = TrajLocX / (1 + (htedge-hbedge)*TrajLocY/(htedge+hbedge)/hapoth) ; // radialy extrapolated x loc position at middle
401  stripTrajMid = TrajLocXMid/Pitch + nstrips/2.0 ;
402  }
403  }
404 
405 
406  if(!badquality && layer<23) {
407  if(resxsig!=1000.0) resolutionPlots[layer]->Fill(stripTrajMid-stripCluster);
408  else resolutionPlots[layer]->Fill(1000);
409  }
410 
411 
412  // New matching methods
413  int tapv = -9;
414  int capv = -9;
415  float stripInAPV = 64.;
416 
417  if ( _clusterMatchingMethod >=1 ) {
418  badflag = false; // reset
419  if(resxsig == 1000.0) { // default value when no cluster found in the module
420  badflag = true; // consider the module inefficient in this case
421  }
422  else{
423  if (_clusterMatchingMethod==2 || _clusterMatchingMethod==4) { // check the distance between cluster and trajectory position
424  if ( abs(stripCluster - stripTrajMid) > _clusterTrajDist ) badflag = true;
425  }
426  if (_clusterMatchingMethod==3 || _clusterMatchingMethod==4) { // cluster and traj have to be in the same APV (don't take edges into accounts)
427  tapv = (int) stripTrajMid/128;
428  capv = (int) stripCluster/128;
429  stripInAPV = stripTrajMid-tapv*128;
430 
431  if(stripInAPV<_stripsApvEdge || stripInAPV>128-_stripsApvEdge) continue;
432  if(tapv != capv) badflag = true;
433  }
434  }
435  }
436 
437 
438 
439  if(badflag && !badquality) {
440  hit temphit;
441  temphit.x = x;
442  temphit.y = y;
443  temphit.z = z;
444  temphit.id = id;
445  hits[layer].push_back(temphit);
446  }
447  pair<unsigned int, unsigned int> newgoodpair (1,1);
448  pair<unsigned int, unsigned int> newbadpair (1,0);
449  //First, figure out if the module already exists in the map of maps
450  map< unsigned int, pair< unsigned int, unsigned int> >::iterator it = modCounter[layer].find(id);
451  if(!badquality) {
452  if(it == modCounter[layer].end()) {
453  if(badflag) modCounter[layer][id] = newbadpair;
454  else modCounter[layer][id] = newgoodpair;
455  }
456  else {
457  ((*it).second.first)++;
458  if(!badflag) ((*it).second.second)++;
459  }
460 
461  if(layerfound_perBx.find(bx)==layerfound_perBx.end()) {
462  layerfound_perBx[bx] = vector<int>(23, 0);
463  layertotal_perBx[bx] = vector<int>(23, 0);
464  }
465  if(!badflag) layerfound_perBx[bx][layer]++;
466  layertotal_perBx[bx][layer]++;
467 
468  if(!badflag) layerfound_vsLumi[layer]->Fill(instLumi);
469  layertotal_vsLumi[layer]->Fill(instLumi);
470  if(!badflag) layerfound_vsPU[layer]->Fill(PU);
471  layertotal_vsPU[layer]->Fill(PU);
472 
473  if(_useCM){
474  if(!badflag) layerfound_vsCM[layer]->Fill(CM);
475  layertotal_vsCM[layer]->Fill(CM);
476  }
477 
478  //Have to do the decoding for which side to go on (ugh)
479  if(layer <= 10) {
480  if(!badflag) goodlayerfound[layer]++;
481  goodlayertotal[layer]++;
482  }
483  else if(layer > 10 && layer < 14) {
484  if( ((id>>13)&0x3) == 1) {
485  if(!badflag) goodlayerfound[layer]++;
486  goodlayertotal[layer]++;
487  }
488  else if( ((id>>13)&0x3) == 2) {
489  if(!badflag) goodlayerfound[layer+3]++;
490  goodlayertotal[layer+3]++;
491  }
492  }
493  else if(layer > 13 && layer <= 22) {
494  if( ((id>>18)&0x3) == 1) {
495  if(!badflag) goodlayerfound[layer+3]++;
496  goodlayertotal[layer+3]++;
497  }
498  else if( ((id>>18)&0x3) == 2) {
499  if(!badflag) goodlayerfound[layer+3+nTEClayers]++;
500  goodlayertotal[layer+3+nTEClayers]++;
501  }
502  }
503  }
504  //Do the one where we don't exclude bad modules!
505  if(layer <= 10) {
506  if(!badflag) alllayerfound[layer]++;
507  alllayertotal[layer]++;
508  }
509  else if(layer > 10 && layer < 14) {
510  if( ((id>>13)&0x3) == 1) {
511  if(!badflag) alllayerfound[layer]++;
512  alllayertotal[layer]++;
513  }
514  else if( ((id>>13)&0x3) == 2) {
515  if(!badflag) alllayerfound[layer+3]++;
516  alllayertotal[layer+3]++;
517  }
518  }
519  else if(layer > 13 && layer <= 22) {
520  if( ((id>>18)&0x3) == 1) {
521  if(!badflag) alllayerfound[layer+3]++;
522  alllayertotal[layer+3]++;
523  }
524  else if( ((id>>18)&0x3) == 2) {
525  if(!badflag) alllayerfound[layer+3+nTEClayers]++;
526  alllayertotal[layer+3+nTEClayers]++;
527  }
528  }
529  //At this point, both of our maps are loaded with the correct information
530  }
531  }// go to next CalibTreeFile
532 
533  makeHotColdMaps();
534  makeTKMap();
535  makeSQLite();
536  totalStatistics();
537  makeSummary();
538  makeSummaryVsBx();
540  if(_useCM) makeSummaryVsCM();
541 
543  //try to write out what's in the quality record
545  int NTkBadComponent[4]; //k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
546  int NBadComponent[4][19][4];
547  //legend: NBadComponent[i][j][k]= SubSystem i, layer/disk/wheel j, BadModule/Fiber/Apv k
548  // i: 0=TIB, 1=TID, 2=TOB, 3=TEC
549  // k: 0=BadModule, 1=BadFiber, 2=BadApv, 3=BadStrips
550  std::stringstream ssV[4][19];
551 
552  for(int i=0;i<4;++i){
553  NTkBadComponent[i]=0;
554  for(int j=0;j<19;++j){
555  ssV[i][j].str("");
556  for(int k=0;k<4;++k)
557  NBadComponent[i][j][k]=0;
558  }
559  }
560 
561 
562  std::vector<SiStripQuality::BadComponent> BC = quality_->getBadComponentList();
563 
564  for (size_t i=0;i<BC.size();++i){
565 
566  //&&&&&&&&&&&&&
567  //Full Tk
568  //&&&&&&&&&&&&&
569 
570  if (BC[i].BadModule)
571  NTkBadComponent[0]++;
572  if (BC[i].BadFibers)
573  NTkBadComponent[1]+= ( (BC[i].BadFibers>>2)&0x1 )+ ( (BC[i].BadFibers>>1)&0x1 ) + ( (BC[i].BadFibers)&0x1 );
574  if (BC[i].BadApvs)
575  NTkBadComponent[2]+= ( (BC[i].BadApvs>>5)&0x1 )+ ( (BC[i].BadApvs>>4)&0x1 ) + ( (BC[i].BadApvs>>3)&0x1 ) +
576  ( (BC[i].BadApvs>>2)&0x1 )+ ( (BC[i].BadApvs>>1)&0x1 ) + ( (BC[i].BadApvs)&0x1 );
577 
578  //&&&&&&&&&&&&&&&&&
579  //Single SubSystem
580  //&&&&&&&&&&&&&&&&&
581 
582  int component;
583  SiStripDetId a(BC[i].detid);
584  if ( a.subdetId() == SiStripDetId::TIB ){
585  //&&&&&&&&&&&&&&&&&
586  //TIB
587  //&&&&&&&&&&&&&&&&&
588 
589  component=tTopo->tibLayer(BC[i].detid);
590  SetBadComponents(0, component, BC[i], ssV, NBadComponent);
591 
592  } else if ( a.subdetId() == SiStripDetId::TID ) {
593  //&&&&&&&&&&&&&&&&&
594  //TID
595  //&&&&&&&&&&&&&&&&&
596 
597  component=tTopo->tidSide(BC[i].detid)==2?tTopo->tidWheel(BC[i].detid):tTopo->tidWheel(BC[i].detid)+3;
598  SetBadComponents(1, component, BC[i], ssV, NBadComponent);
599 
600  } else if ( a.subdetId() == SiStripDetId::TOB ) {
601  //&&&&&&&&&&&&&&&&&
602  //TOB
603  //&&&&&&&&&&&&&&&&&
604 
605  component=tTopo->tobLayer(BC[i].detid);
606  SetBadComponents(2, component, BC[i], ssV, NBadComponent);
607 
608  } else if ( a.subdetId() == SiStripDetId::TEC ) {
609  //&&&&&&&&&&&&&&&&&
610  //TEC
611  //&&&&&&&&&&&&&&&&&
612 
613  component=tTopo->tecSide(BC[i].detid)==2?tTopo->tecWheel(BC[i].detid):tTopo->tecWheel(BC[i].detid)+9;
614  SetBadComponents(3, component, BC[i], ssV, NBadComponent);
615 
616  }
617  }
618 
619  //&&&&&&&&&&&&&&&&&&
620  // Single Strip Info
621  //&&&&&&&&&&&&&&&&&&
622  float percentage=0;
623 
626 
627  for (SiStripBadStrip::RegistryIterator rp=rbegin; rp != rend; ++rp) {
628  unsigned int detid=rp->detid;
629 
630  int subdet=-999; int component=-999;
631  SiStripDetId a(detid);
632  if ( a.subdetId() == 3 ){
633  subdet=0;
634  component=tTopo->tibLayer(detid);
635  } else if ( a.subdetId() == 4 ) {
636  subdet=1;
637  component=tTopo->tidSide(detid)==2?tTopo->tidWheel(detid):tTopo->tidWheel(detid)+3;
638  } else if ( a.subdetId() == 5 ) {
639  subdet=2;
640  component=tTopo->tobLayer(detid);
641  } else if ( a.subdetId() == 6 ) {
642  subdet=3;
643  component=tTopo->tecSide(detid)==2?tTopo->tecWheel(detid):tTopo->tecWheel(detid)+9;
644  }
645 
647 
648  percentage=0;
649  for(int it=0;it<sqrange.second-sqrange.first;it++){
650  unsigned int range=quality_->decode( *(sqrange.first+it) ).range;
651  NTkBadComponent[3]+=range;
652  NBadComponent[subdet][0][3]+=range;
653  NBadComponent[subdet][component][3]+=range;
654  percentage+=range;
655  }
656  if(percentage!=0)
657  percentage/=128.*reader->getNumberOfApvsAndStripLength(detid).first;
658  if(percentage>1)
659  edm::LogError("SiStripQualityStatistics") << "PROBLEM detid " << detid << " value " << percentage<< std::endl;
660  }
661  //&&&&&&&&&&&&&&&&&&
662  // printout
663  //&&&&&&&&&&&&&&&&&&
664 
665  cout << "\n-----------------\nNew IOV starting from run " << e.id().run() << " event " << e.id().event() << " lumiBlock " << e.luminosityBlock() << " time " << e.time().value() << "\n-----------------\n";
666  cout << "\n-----------------\nGlobal Info\n-----------------";
667  cout << "\nBadComponent \t Modules \tFibers \tApvs\tStrips\n----------------------------------------------------------------";
668  cout << "\nTracker:\t\t"<<NTkBadComponent[0]<<"\t"<<NTkBadComponent[1]<<"\t"<<NTkBadComponent[2]<<"\t"<<NTkBadComponent[3];
669  cout << endl;
670  cout << "\nTIB:\t\t\t"<<NBadComponent[0][0][0]<<"\t"<<NBadComponent[0][0][1]<<"\t"<<NBadComponent[0][0][2]<<"\t"<<NBadComponent[0][0][3];
671  cout << "\nTID:\t\t\t"<<NBadComponent[1][0][0]<<"\t"<<NBadComponent[1][0][1]<<"\t"<<NBadComponent[1][0][2]<<"\t"<<NBadComponent[1][0][3];
672  cout << "\nTOB:\t\t\t"<<NBadComponent[2][0][0]<<"\t"<<NBadComponent[2][0][1]<<"\t"<<NBadComponent[2][0][2]<<"\t"<<NBadComponent[2][0][3];
673  cout << "\nTEC:\t\t\t"<<NBadComponent[3][0][0]<<"\t"<<NBadComponent[3][0][1]<<"\t"<<NBadComponent[3][0][2]<<"\t"<<NBadComponent[3][0][3];
674  cout << "\n";
675 
676  for (int i=1;i<5;++i)
677  cout << "\nTIB Layer " << i << " :\t\t"<<NBadComponent[0][i][0]<<"\t"<<NBadComponent[0][i][1]<<"\t"<<NBadComponent[0][i][2]<<"\t"<<NBadComponent[0][i][3];
678  cout << "\n";
679  for (int i=1;i<4;++i)
680  cout << "\nTID+ Disk " << i << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
681  for (int i=4;i<7;++i)
682  cout << "\nTID- Disk " << i-3 << " :\t\t"<<NBadComponent[1][i][0]<<"\t"<<NBadComponent[1][i][1]<<"\t"<<NBadComponent[1][i][2]<<"\t"<<NBadComponent[1][i][3];
683  cout << "\n";
684  for (int i=1;i<7;++i)
685  cout << "\nTOB Layer " << i << " :\t\t"<<NBadComponent[2][i][0]<<"\t"<<NBadComponent[2][i][1]<<"\t"<<NBadComponent[2][i][2]<<"\t"<<NBadComponent[2][i][3];
686  cout << "\n";
687  for (int i=1;i<10;++i)
688  cout << "\nTEC+ Disk " << i << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
689  for (int i=10;i<19;++i)
690  cout << "\nTEC- Disk " << i-9 << " :\t\t"<<NBadComponent[3][i][0]<<"\t"<<NBadComponent[3][i][1]<<"\t"<<NBadComponent[3][i][2]<<"\t"<<NBadComponent[3][i][3];
691  cout << "\n";
692 
693  cout << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
694  for (int i=1;i<5;++i)
695  cout << "\nTIB Layer " << i << " :" << ssV[0][i].str();
696  cout << "\n";
697  for (int i=1;i<4;++i)
698  cout << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
699  for (int i=4;i<7;++i)
700  cout << "\nTID- Disk " << i-3 << " :" << ssV[1][i].str();
701  cout << "\n";
702  for (int i=1;i<7;++i)
703  cout << "\nTOB Layer " << i << " :" << ssV[2][i].str();
704  cout << "\n";
705  for (int i=1;i<10;++i)
706  cout << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
707  for (int i=10;i<19;++i)
708  cout << "\nTEC- Disk " << i-9 << " :" << ssV[3][i].str();
709 
710  // store also bad modules in log file
711  ofstream badModules;
712  badModules.open("BadModules.log");
713  badModules << "\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers Apvs\n----------------------------------------------------------------";
714  for (int i=1;i<5;++i)
715  badModules << "\nTIB Layer " << i << " :" << ssV[0][i].str();
716  badModules << "\n";
717  for (int i=1;i<4;++i)
718  badModules << "\nTID+ Disk " << i << " :" << ssV[1][i].str();
719  for (int i=4;i<7;++i)
720  badModules << "\nTID- Disk " << i-3 << " :" << ssV[1][i].str();
721  badModules << "\n";
722  for (int i=1;i<7;++i)
723  badModules << "\nTOB Layer " << i << " :" << ssV[2][i].str();
724  badModules << "\n";
725  for (int i=1;i<10;++i)
726  badModules << "\nTEC+ Disk " << i << " :" << ssV[3][i].str();
727  for (int i=10;i<19;++i)
728  badModules << "\nTEC- Disk " << i-9 << " :" << ssV[3][i].str();
729  badModules.close();
730 
731 }
unsigned short range
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
const std::vector< BadComponent > & getBadComponentList() const
unsigned int tibLayer(const DetId &id) const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:63
const Bounds & bounds() const
Definition: Surface.h:120
unsigned int tidWheel(const DetId &id) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
void SetBadComponents(int i, int component, SiStripQuality::BadComponent &BC, std::stringstream ssV[4][19], int NBadComponent[4][19][4])
Registry::const_iterator RegistryIterator
SiStripDetInfoFileReader * reader
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
virtual float width() const =0
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
RegistryIterator getRegistryVectorEnd() const
edm::Service< TFileService > fs
map< unsigned int, vector< int > > layerfound_perBx
unsigned int tidSide(const DetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:37
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[23]
int k[5][pyjets_maxn]
unsigned int id
ContainerIterator getDataVectorBegin() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
virtual int nstrips() const =0
const T & get() const
Definition: EventSetup.h:55
RegistryIterator getRegistryVectorBegin() const
edm::EventID id() const
Definition: EventBase.h:60
map< unsigned int, vector< int > > layertotal_perBx
double a
Definition: hdecay.h:121
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int tecWheel(const DetId &id) const
T const * product() const
Definition: ESHandle.h:86
TimeValue_t value() const
Definition: Timestamp.h:56
edm::Timestamp time() const
Definition: EventBase.h:61
data decode(const unsigned int &value) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
void SiStripHitEffFromCalibTree::algoBeginJob ( )
privatevirtual

Definition at line 203 of file SiStripHitEffFromCalibTree.cc.

203  {
204  //I have no idea what goes here
205  //fs->make<TTree>("HitEffHistos","Tree of the inefficient hit histograms");
206 }
void SiStripHitEffFromCalibTree::algoEndJob ( )
overrideprivatevirtual

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 208 of file SiStripHitEffFromCalibTree.cc.

208  {
209  //Still have no idea what goes here
210 
211 }
float SiStripHitEffFromCalibTree::calcPhi ( float  x,
float  y 
)
private

Definition at line 1358 of file SiStripHitEffFromCalibTree.cc.

References phi, and Pi.

Referenced by makeHotColdMaps().

1358  {
1359  float phi = 0;
1360  float Pi = 3.14159;
1361  if((x>=0)&&(y>=0)) phi = atan(y/x);
1362  else if((x>=0)&&(y<=0)) phi = atan(y/x) + 2*Pi;
1363  else if((x<=0)&&(y>=0)) phi = atan(y/x) + Pi;
1364  else phi = atan(y/x) + Pi;
1365  phi = phi*180.0/Pi;
1366 
1367  return phi;
1368 }
const double Pi
void SiStripHitEffFromCalibTree::ComputeEff ( vector< TH1F * > &  vhfound,
vector< TH1F * > &  vhtotal,
string  name 
)
private

Definition at line 1249 of file SiStripHitEffFromCalibTree.cc.

References _showRings, MillePedeFileConverter_cfg::e, fs, GetLayerName(), mps_fire::i, TFileService::make(), and MuonTCMETValueMapProducer_cff::nLayers.

Referenced by makeSummaryVsCM(), and makeSummaryVsLumi().

1249  {
1250 
1251  unsigned int nLayers = 22;
1252  if(_showRings) nLayers = 20;
1253 
1254  TH1F* hfound;
1255  TH1F* htotal;
1256 
1257  for(unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1258 
1259  hfound = vhfound[ilayer];
1260  htotal = vhtotal[ilayer];
1261 
1262  hfound->Sumw2();
1263  htotal->Sumw2();
1264 
1265  // new ROOT version: TGraph::Divide don't handle null or negative values
1266  for (Long_t i=0; i< hfound->GetNbinsX()+1; ++i) {
1267  if( hfound->GetBinContent(i)==0) hfound->SetBinContent(i,1e-6);
1268  if( htotal->GetBinContent(i)==0) htotal->SetBinContent(i,1);
1269  }
1270 
1271  TGraphAsymmErrors *geff = fs->make<TGraphAsymmErrors>(hfound->GetNbinsX());
1272  geff->SetName(Form("%s_layer%i", name.c_str(), ilayer));
1273  geff->BayesDivide(hfound, htotal);
1274  if(name=="effVsLumi") geff->SetTitle("Hit Efficiency vs inst. lumi. - "+GetLayerName(ilayer));
1275  if(name=="effVsPU") geff->SetTitle("Hit Efficiency vs pileup - "+GetLayerName(ilayer));
1276  if(name=="effVsCM") geff->SetTitle("Hit Efficiency vs common Mode - "+GetLayerName(ilayer));
1277  geff->SetMarkerStyle(20);
1278 
1279  }
1280 
1281 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::Service< TFileService > fs
TString SiStripHitEffFromCalibTree::GetLayerName ( Long_t  k)
private

Definition at line 1231 of file SiStripHitEffFromCalibTree.cc.

References _showRings, gen::k, and nTEClayers.

Referenced by algoAnalyze(), ComputeEff(), makeSummary(), and makeSummaryVsBx().

1231  {
1232 
1233  TString layername="";
1234  TString ringlabel="D";
1235  if(_showRings) ringlabel="R";
1236  if (k>0 && k<5) {
1237  layername = TString("TIB L") + k;
1238  } else if (k>4 && k<11) {
1239  layername = TString("TOB L")+(k-4);
1240  } else if (k>10 && k<14) {
1241  layername = TString("TID ")+ringlabel+(k-10);
1242  } else if (k>13 && k<14+nTEClayers) {
1243  layername = TString("TEC ")+ringlabel+(k-13);
1244  }
1245 
1246  return layername;
1247 }
int k[5][pyjets_maxn]
TString SiStripHitEffFromCalibTree::GetLayerSideName ( Long_t  k)
private

Definition at line 1319 of file SiStripHitEffFromCalibTree.cc.

References _showRings, gen::k, and nTEClayers.

Referenced by makeSummary().

1319  {
1320 
1321  TString layername="";
1322  TString ringlabel="D";
1323  if(_showRings) ringlabel="R";
1324  if (k>0 && k<5) {
1325  layername = TString("TIB L") + k;
1326  } else if (k>4&&k<11) {
1327  layername = TString("TOB L")+(k-4);
1328  } else if (k>10&&k<14) {
1329  layername = TString("TID- ")+ringlabel+(k-10);
1330  } else if (k>13&&k<17) {
1331  layername = TString("TID+ ")+ringlabel+(k-13);
1332  } else if (k>16&&k<17+nTEClayers) {
1333  layername = TString("TEC- ")+ringlabel+(k-16);
1334  } else if (k>16+nTEClayers) {
1335  layername = TString("TEC+ ")+ringlabel+(k-16-nTEClayers);
1336  }
1337 
1338  return layername;
1339 }
int k[5][pyjets_maxn]
SiStripBadStrip * SiStripHitEffFromCalibTree::getNewObject ( )
overrideprivatevirtual

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 1341 of file SiStripHitEffFromCalibTree.cc.

References SiStripBadStrip::getDataVectorBegin(), SiStripBadStrip::getRegistryVectorBegin(), SiStripBadStrip::getRegistryVectorEnd(), MuonAssociatorByHits_cfi::obj, SiStripBadStrip::put(), and quality_.

1341  {
1342  //Need this for a Condition DB Writer
1343  //Initialize a return variable
1345 
1348 
1349  for(;rIter!=rIterEnd;++rIter){
1350  SiStripBadStrip::Range range(quality_->getDataVectorBegin()+rIter->ibegin,quality_->getDataVectorBegin()+rIter->iend);
1351  if ( ! obj->put(rIter->detid,range) )
1352  edm::LogError("SiStripHitEffFromCalibTree")<<"[SiStripHitEffFromCalibTree::getNewObject] detid already exists"<<std::endl;
1353  }
1354 
1355  return obj;
1356 }
Registry::const_iterator RegistryIterator
RegistryIterator getRegistryVectorEnd() const
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
std::pair< ContainerIterator, ContainerIterator > Range
bool put(const uint32_t &detID, const InputVector &vect)
void SiStripHitEffFromCalibTree::makeHotColdMaps ( )
private

Definition at line 733 of file SiStripHitEffFromCalibTree.cc.

References begin, calcPhi(), gather_cfg::cout, fs, hits, HotColdMaps, TFileService::make(), and phi.

Referenced by algoAnalyze().

733  {
734  cout << "Entering hot cold map generation!\n";
735  TStyle* gStyle = new TStyle("gStyle","myStyle");
736  gStyle->cd();
737  gStyle->SetPalette(1);
738  gStyle->SetCanvasColor(kWhite);
739  gStyle->SetOptStat(0);
740  //Here we make the hot/cold color maps that we love so very much
741  //Already have access to the data as a private variable
742  //Create all of the histograms in the TFileService
743  TH2F *temph2;
744  for(Long_t maplayer = 1; maplayer <=22; maplayer++) {
745  //Initialize all of the histograms
746  if(maplayer > 0 && maplayer <= 4) {
747  //We are in the TIB
748  temph2 = fs->make<TH2F>(Form("%s%i","TIB",(int)(maplayer)),"TIB",100,-1,361,100,-100,100);
749  temph2->GetXaxis()->SetTitle("Phi");
750  temph2->GetXaxis()->SetBinLabel(1,TString("360"));
751  temph2->GetXaxis()->SetBinLabel(50,TString("180"));
752  temph2->GetXaxis()->SetBinLabel(100,TString("0"));
753  temph2->GetYaxis()->SetTitle("Global Z");
754  temph2->SetOption("colz");
755  HotColdMaps.push_back(temph2);
756  }
757  else if(maplayer > 4 && maplayer <= 10) {
758  //We are in the TOB
759  temph2 = fs->make<TH2F>(Form("%s%i","TOB",(int)(maplayer-4)),"TOB",100,-1,361,100,-120,120);
760  temph2->GetXaxis()->SetTitle("Phi");
761  temph2->GetXaxis()->SetBinLabel(1,TString("360"));
762  temph2->GetXaxis()->SetBinLabel(50,TString("180"));
763  temph2->GetXaxis()->SetBinLabel(100,TString("0"));
764  temph2->GetYaxis()->SetTitle("Global Z");
765  temph2->SetOption("colz");
766  HotColdMaps.push_back(temph2);
767  }
768  else if(maplayer > 10 && maplayer <= 13) {
769  //We are in the TID
770  //Split by +/-
771  temph2 = fs->make<TH2F>(Form("%s%i","TID-",(int)(maplayer-10)),"TID-",100,-100,100,100,-100,100);
772  temph2->GetXaxis()->SetTitle("Global Y");
773  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
774  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
775  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
776  temph2->GetYaxis()->SetTitle("Global X");
777  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
778  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
779  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
780  temph2->SetOption("colz");
781  HotColdMaps.push_back(temph2);
782  temph2 = fs->make<TH2F>(Form("%s%i","TID+",(int)(maplayer-10)),"TID+",100,-100,100,100,-100,100);
783  temph2->GetXaxis()->SetTitle("Global Y");
784  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
785  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
786  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
787  temph2->GetYaxis()->SetTitle("Global X");
788  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
789  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
790  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
791  temph2->SetOption("colz");
792  HotColdMaps.push_back(temph2);
793  }
794  else if(maplayer > 13) {
795  //We are in the TEC
796  //Split by +/-
797  temph2 = fs->make<TH2F>(Form("%s%i","TEC-",(int)(maplayer-13)),"TEC-",100,-120,120,100,-120,120);
798  temph2->GetXaxis()->SetTitle("Global Y");
799  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
800  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
801  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
802  temph2->GetYaxis()->SetTitle("Global X");
803  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
804  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
805  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
806  temph2->SetOption("colz");
807  HotColdMaps.push_back(temph2);
808  temph2 = fs->make<TH2F>(Form("%s%i","TEC+",(int)(maplayer-13)),"TEC+",100,-120,120,100,-120,120);
809  temph2->GetXaxis()->SetTitle("Global Y");
810  temph2->GetXaxis()->SetBinLabel(1,TString("+Y"));
811  temph2->GetXaxis()->SetBinLabel(50,TString("0"));
812  temph2->GetXaxis()->SetBinLabel(100,TString("-Y"));
813  temph2->GetYaxis()->SetTitle("Global X");
814  temph2->GetYaxis()->SetBinLabel(1,TString("-X"));
815  temph2->GetYaxis()->SetBinLabel(50,TString("0"));
816  temph2->GetYaxis()->SetBinLabel(100,TString("+X"));
817  temph2->SetOption("colz");
818  HotColdMaps.push_back(temph2);
819  }
820  }
821  for(Long_t mylayer = 1; mylayer <= 22; mylayer++) {
822  //Determine what kind of plot we want to write out
823  //Loop through the entirety of each layer
824  //Create an array of the histograms
825  vector<hit>::const_iterator iter;
826  for(iter = hits[mylayer].begin(); iter != hits[mylayer].end(); iter++) {
827  //Looping over the particular layer
828  //Fill by 360-x to get the proper location to compare with TKMaps of phi
829  //Also global xy is messed up
830  if(mylayer > 0 && mylayer <= 4) {
831  //We are in the TIB
832  float phi = calcPhi(iter->x, iter->y);
833  HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
834  }
835  else if(mylayer > 4 && mylayer <= 10) {
836  //We are in the TOB
837  float phi = calcPhi(iter->x,iter->y);
838  HotColdMaps[mylayer - 1]->Fill(360.-phi,iter->z,1.);
839  }
840  else if(mylayer > 10 && mylayer <= 13) {
841  //We are in the TID
842  //There are 2 different maps here
843  int side = (((iter->id)>>13) & 0x3);
844  if(side == 1) HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(-iter->y,iter->x,1.);
845  else if(side == 2) HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(-iter->y,iter->x,1.);
846  //if(side == 1) HotColdMaps[(mylayer - 1) + (mylayer - 11)]->Fill(iter->x,iter->y,1.);
847  //else if(side == 2) HotColdMaps[(mylayer - 1) + (mylayer - 10)]->Fill(iter->x,iter->y,1.);
848  }
849  else if(mylayer > 13) {
850  //We are in the TEC
851  //There are 2 different maps here
852  int side = (((iter->id)>>18) & 0x3);
853  if(side == 1) HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(-iter->y,iter->x,1.);
854  else if(side == 2) HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(-iter->y,iter->x,1.);
855  //if(side == 1) HotColdMaps[(mylayer + 2) + (mylayer - 14)]->Fill(iter->x,iter->y,1.);
856  //else if(side == 2) HotColdMaps[(mylayer + 2) + (mylayer - 13)]->Fill(iter->x,iter->y,1.);
857  }
858  }
859  }
860  cout << "Finished HotCold Map Generation\n";
861 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::Service< TFileService > fs
#define begin
Definition: vmac.h:30
void SiStripHitEffFromCalibTree::makeSQLite ( )
private

Definition at line 922 of file SiStripHitEffFromCalibTree.cc.

References BadModules, SiStripQuality::compact(), gather_cfg::cout, SiStripBadStrip::encode(), SiStripQuality::fillBadComponents(), SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), createfilelist::int, SiStripBadStrip::put(), quality_, and reader.

Referenced by algoAnalyze().

922  {
923  //Generate the SQLite file for use in the Database of the bad modules!
924  cout << "Entering SQLite file generation!\n";
925  std::vector<unsigned int> BadStripList;
926  unsigned short NStrips;
927  unsigned int id1;
928  SiStripQuality* pQuality = new SiStripQuality;
929  //This is the list of the bad strips, use to mask out entire APVs
930  //Now simply go through the bad hit list and mask out things that
931  //are bad!
932  map< unsigned int, double >::const_iterator it;
933  for(it = BadModules.begin(); it != BadModules.end(); it++) {
934  //We need to figure out how many strips are in this particular module
935  //To Mask correctly!
936  NStrips=reader->getNumberOfApvsAndStripLength((*it).first).first*128;
937  cout << "Number of strips module " << (*it).first << " is " << NStrips << endl;
938  BadStripList.push_back(pQuality->encode(0,NStrips,0));
939  //Now compact into a single bad module
940  id1=(unsigned int)(*it).first;
941  cout << "ID1 shoudl match list of modules above " << id1 << endl;
942  quality_->compact(id1,BadStripList);
943  SiStripQuality::Range range(BadStripList.begin(),BadStripList.end());
944  quality_->put(id1,range);
945  BadStripList.clear();
946  }
947  //Fill all the bad components now
949 }
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
SiStripDetInfoFileReader * reader
void compact(unsigned int &, std::vector< unsigned int > &)
void fillBadComponents()
std::pair< ContainerIterator, ContainerIterator > Range
map< unsigned int, double > BadModules
bool put(const uint32_t &detID, const InputVector &vect)
unsigned int encode(const unsigned short &first, const unsigned short &NconsecutiveBadStrips, const unsigned short &flag=0)
void SiStripHitEffFromCalibTree::makeSummary ( )
private

Definition at line 980 of file SiStripHitEffFromCalibTree.cc.

References _effPlotMin, _showEndcapSides, _showOnlyGoodModules, _showRings, _showTOB6TEC9, _title, Vispa.Plugins.EdmBrowser.EdmDataAccessor::all(), alllayerfound, alllayertotal, gather_cfg::cout, MillePedeFileConverter_cfg::e, runEdmFileComparison::found, fs, GetLayerName(), GetLayerSideName(), goodlayerfound, goodlayertotal, mps_fire::i, gen::k, diffTwoXMLs::label, create_public_lumi_plots::leg, TFileService::make(), MuonTCMETValueMapProducer_cff::nLayers, nTEClayers, and compare::overlay().

Referenced by algoAnalyze().

980  {
981  //setTDRStyle();
982 
983  int nLayers = 34;
984  if(_showRings) nLayers = 30;
985  if(!_showEndcapSides) {
986  if(!_showRings) nLayers=22;
987  else nLayers=20;
988  }
989 
990  TH1F *found = fs->make<TH1F>("found","found",nLayers+1,0,nLayers+1);
991  TH1F *all = fs->make<TH1F>("all","all",nLayers+1,0,nLayers+1);
992  TH1F *found2 = fs->make<TH1F>("found2","found2",nLayers+1,0,nLayers+1);
993  TH1F *all2 = fs->make<TH1F>("all2","all2",nLayers+1,0,nLayers+1);
994  // first bin only to keep real data off the y axis so set to -1
995  found->SetBinContent(0,-1);
996  all->SetBinContent(0,1);
997 
998  // new ROOT version: TGraph::Divide don't handle null or negative values
999  for (Long_t i=1; i< nLayers+2; ++i) {
1000  found->SetBinContent(i,1e-6);
1001  all->SetBinContent(i,1);
1002  found2->SetBinContent(i,1e-6);
1003  all2->SetBinContent(i,1);
1004  }
1005 
1006  TCanvas *c7 =new TCanvas("c7"," test ",10,10,800,600);
1007  c7->SetFillColor(0);
1008  c7->SetGrid();
1009 
1010  int nLayers_max=nLayers+1; // barrel+endcap
1011  if(!_showEndcapSides) nLayers_max=11; // barrel
1012  for (Long_t i=1; i< nLayers_max; ++i) {
1013  cout << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i] << " B = " << goodlayertotal[i] << endl;
1014  if (goodlayertotal[i] > 5) {
1015  found->SetBinContent(i,goodlayerfound[i]);
1016  all->SetBinContent(i,goodlayertotal[i]);
1017  }
1018 
1019  cout << "Filling all modules layer " << i << ": S = " << alllayerfound[i] << " B = " << alllayertotal[i] << endl;
1020  if (alllayertotal[i] > 5) {
1021  found2->SetBinContent(i,alllayerfound[i]);
1022  all2->SetBinContent(i,alllayertotal[i]);
1023  }
1024 
1025  }
1026 
1027  // endcap - merging sides
1028  if(!_showEndcapSides) {
1029  for (Long_t i=11; i< 14; ++i) { // TID disks
1030  cout << "Fill only good modules layer " << i << ": S = " << goodlayerfound[i]+goodlayerfound[i+3] << " B = " << goodlayertotal[i]+goodlayertotal[i+3] << endl;
1031  if (goodlayertotal[i]+goodlayertotal[i+3] > 5) {
1032  found->SetBinContent(i,goodlayerfound[i]+goodlayerfound[i+3]);
1033  all->SetBinContent(i,goodlayertotal[i]+goodlayertotal[i+3]);
1034  }
1035  cout << "Filling all modules layer " << i << ": S = " << alllayerfound[i]+alllayerfound[i+3] << " B = " << alllayertotal[i]+alllayertotal[i+3] << endl;
1036  if (alllayertotal[i]+alllayertotal[i+3] > 5) {
1037  found2->SetBinContent(i,alllayerfound[i]+alllayerfound[i+3]);
1038  all2->SetBinContent(i,alllayertotal[i]+alllayertotal[i+3]);
1039  }
1040  }
1041  for (Long_t i=17; i< 17+nTEClayers; ++i) { // TEC disks
1042  cout << "Fill only good modules layer " << i-3 << ": S = " << goodlayerfound[i]+goodlayerfound[i+nTEClayers] << " B = " << goodlayertotal[i]+goodlayertotal[i+nTEClayers] << endl;
1043  if (goodlayertotal[i]+goodlayertotal[i+nTEClayers] > 5) {
1044  found->SetBinContent(i-3,goodlayerfound[i]+goodlayerfound[i+nTEClayers]);
1045  all->SetBinContent(i-3,goodlayertotal[i]+goodlayertotal[i+nTEClayers]);
1046  }
1047  cout << "Filling all modules layer " << i-3 << ": S = " << alllayerfound[i]+alllayerfound[i+nTEClayers] << " B = " << alllayertotal[i]+alllayertotal[i+nTEClayers] << endl;
1048  if (alllayertotal[i]+alllayertotal[i+nTEClayers] > 5) {
1049  found2->SetBinContent(i-3,alllayerfound[i]+alllayerfound[i+nTEClayers]);
1050  all2->SetBinContent(i-3,alllayertotal[i]+alllayertotal[i+nTEClayers]);
1051  }
1052  }
1053  }
1054 
1055  found->Sumw2();
1056  all->Sumw2();
1057 
1058  found2->Sumw2();
1059  all2->Sumw2();
1060 
1061  TGraphAsymmErrors *gr = fs->make<TGraphAsymmErrors>(nLayers+1);
1062  gr->SetName("eff_good");
1063  gr->BayesDivide(found,all);
1064 
1065  TGraphAsymmErrors *gr2 = fs->make<TGraphAsymmErrors>(nLayers+1);
1066  gr2->SetName("eff_all");
1067  gr2->BayesDivide(found2,all2);
1068 
1069  for(int j = 0; j<nLayers+1; j++){
1070  gr->SetPointError(j, 0., 0., gr->GetErrorYlow(j),gr->GetErrorYhigh(j) );
1071  gr2->SetPointError(j, 0., 0., gr2->GetErrorYlow(j),gr2->GetErrorYhigh(j) );
1072  }
1073 
1074  gr->GetXaxis()->SetLimits(0,nLayers);
1075  gr->SetMarkerColor(2);
1076  gr->SetMarkerSize(1.2);
1077  gr->SetLineColor(2);
1078  gr->SetLineWidth(4);
1079  gr->SetMarkerStyle(20);
1080  gr->SetMinimum(_effPlotMin);
1081  gr->SetMaximum(1.001);
1082  gr->GetYaxis()->SetTitle("Efficiency");
1083  gStyle->SetTitleFillColor(0);
1084  gStyle->SetTitleBorderSize(0);
1085  gr->SetTitle(_title);
1086 
1087  gr2->GetXaxis()->SetLimits(0,nLayers);
1088  gr2->SetMarkerColor(1);
1089  gr2->SetMarkerSize(1.2);
1090  gr2->SetLineColor(1);
1091  gr2->SetLineWidth(4);
1092  gr2->SetMarkerStyle(21);
1093  gr2->SetMinimum(_effPlotMin);
1094  gr2->SetMaximum(1.001);
1095  gr2->GetYaxis()->SetTitle("Efficiency");
1096  gr2->SetTitle(_title);
1097 
1098  for ( Long_t k=1; k<nLayers+1; k++) {
1099  TString label;
1100  if(_showEndcapSides) label = GetLayerSideName(k);
1101  else label = GetLayerName(k);
1102  if(!_showTOB6TEC9) {
1103  if(k==10) label="";
1104  if(!_showRings && k==nLayers) label="";
1105  if(!_showRings && _showEndcapSides && k==25) label="";
1106  }
1107  if(!_showRings) {
1108  if(_showEndcapSides) {
1109  gr->GetXaxis()->SetBinLabel(((k+1)*100+2)/(nLayers)-4,label);
1110  gr2->GetXaxis()->SetBinLabel(((k+1)*100+2)/(nLayers)-4,label);
1111  }
1112  else {
1113  gr->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-6,label);
1114  gr2->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-6,label);
1115  }
1116  }
1117  else {
1118  if(_showEndcapSides) {
1119  gr->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-4,label);
1120  gr2->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-4,label);
1121  }
1122  else {
1123  gr->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-7,label);
1124  gr2->GetXaxis()->SetBinLabel((k+1)*100/(nLayers)-7,label);
1125  }
1126  }
1127  }
1128 
1129  gr->Draw("AP");
1130  gr->GetXaxis()->SetNdivisions(36);
1131 
1132  c7->cd();
1133  TPad *overlay = new TPad("overlay","",0,0,1,1);
1134  overlay->SetFillStyle(4000);
1135  overlay->SetFillColor(0);
1136  overlay->SetFrameFillStyle(4000);
1137  overlay->Draw("same");
1138  overlay->cd();
1139  if(!_showOnlyGoodModules) gr2->Draw("AP");
1140 
1141  TLegend *leg = new TLegend(0.70,0.27,0.88,0.40);
1142  leg->AddEntry(gr,"Good Modules","p");
1143  if(!_showOnlyGoodModules) leg->AddEntry(gr2,"All Modules","p");
1144  leg->SetTextSize(0.020);
1145  leg->SetFillColor(0);
1146  leg->Draw("same");
1147 
1148  c7->SaveAs("Summary.png");
1149 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
def overlay(hists, ytitle, header, addon)
Definition: compare.py:119
edm::Service< TFileService > fs
int k[5][pyjets_maxn]
void SiStripHitEffFromCalibTree::makeSummaryVsBx ( )
private

Definition at line 1152 of file SiStripHitEffFromCalibTree.cc.

References _showRings, _spaceBetweenTrains, gather_cfg::cout, MillePedeFileConverter_cfg::e, objects.autophobj::float, runEdmFileComparison::found, fs, GetLayerName(), layerfound_perBx, layertotal_perBx, TFileService::make(), MuonTCMETValueMapProducer_cff::nLayers, pileupDistInMC::total, and up.

Referenced by algoAnalyze().

1152  {
1153  cout<<"Computing efficiency vs bx"<<endl;
1154 
1155  unsigned int nLayers = 22;
1156  if(_showRings) nLayers = 20;
1157 
1158  for(unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1159  TH1F *hfound = fs->make<TH1F>(Form("foundVsBx_layer%i", ilayer),Form("layer %i", ilayer),3565,0,3565);
1160  TH1F *htotal = fs->make<TH1F>(Form("totalVsBx_layer%i", ilayer),Form("layer %i", ilayer),3565,0,3565);
1161 
1162  for(unsigned int ibx=0; ibx<3566; ibx++){
1163  hfound->SetBinContent(ibx, 1e-6);
1164  htotal->SetBinContent(ibx, 1);
1165  }
1166  map<unsigned int, vector<int> >::iterator iterMapvsBx;
1167  for(iterMapvsBx=layerfound_perBx.begin(); iterMapvsBx!=layerfound_perBx.end(); ++iterMapvsBx)
1168  hfound->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1169  for(iterMapvsBx=layertotal_perBx.begin(); iterMapvsBx!=layertotal_perBx.end(); ++iterMapvsBx)
1170  if(iterMapvsBx->second[ilayer]>0) htotal->SetBinContent( iterMapvsBx->first, iterMapvsBx->second[ilayer]);
1171 
1172  hfound->Sumw2();
1173  htotal->Sumw2();
1174 
1175  TGraphAsymmErrors *geff = fs->make<TGraphAsymmErrors>(3564);
1176  geff->SetName(Form("effVsBx_layer%i", ilayer));
1177  geff->SetTitle("Hit Efficiency vs bx - "+GetLayerName(ilayer));
1178  geff->BayesDivide(hfound,htotal);
1179 
1180  //Average over trains
1181  TGraphAsymmErrors *geff_avg = fs->make<TGraphAsymmErrors>();
1182  geff_avg->SetName(Form("effVsBxAvg_layer%i", ilayer));
1183  geff_avg->SetTitle("Hit Efficiency vs bx - "+GetLayerName(ilayer));
1184  geff_avg->SetMarkerStyle(20);
1185  int ibx=0;
1186  int previous_bx=-80;
1187  int delta_bx=0;
1188  int nbx=0;
1189  int found=0;
1190  int total=0;
1191  double sum_bx=0;
1192  int ipt=0;
1193  float low, up, eff;
1194  int firstbx=0;
1195  for(iterMapvsBx=layertotal_perBx.begin(); iterMapvsBx!=layertotal_perBx.end(); ++iterMapvsBx){
1196  ibx=iterMapvsBx->first;
1197  delta_bx=ibx-previous_bx;
1198  // consider a new train
1199  if(delta_bx>(int)_spaceBetweenTrains && nbx>0 && total>0){
1200  eff=found/(float)total;
1201  //cout<<"new train "<<ipt<<" "<<sum_bx/nbx<<" "<<eff<<endl;
1202  geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1203  low = TEfficiency::Bayesian(total, found, .683, 1, 1, false);
1204  up = TEfficiency::Bayesian(total, found, .683, 1, 1, true);
1205  geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1206  ipt++;
1207  sum_bx=0;
1208  found=0;
1209  total=0;
1210  nbx=0;
1211  firstbx=ibx;
1212  }
1213  sum_bx+=ibx;
1214  found+=hfound->GetBinContent(ibx);
1215  total+=htotal->GetBinContent(ibx);
1216  nbx++;
1217 
1218  previous_bx=ibx;
1219  }
1220  //last train
1221  eff=found/(float)total;
1222  //cout<<"new train "<<ipt<<" "<<sum_bx/nbx<<" "<<eff<<endl;
1223  geff_avg->SetPoint(ipt, sum_bx/nbx, eff);
1224  low = TEfficiency::Bayesian(total, found, .683, 1, 1, false);
1225  up = TEfficiency::Bayesian(total, found, .683, 1, 1, true);
1226  geff_avg->SetPointError(ipt, sum_bx/nbx-firstbx, previous_bx-sum_bx/nbx, eff-low, up-eff);
1227  }
1228 }
Definition: BitonicSort.h:8
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::Service< TFileService > fs
map< unsigned int, vector< int > > layerfound_perBx
map< unsigned int, vector< int > > layertotal_perBx
void SiStripHitEffFromCalibTree::makeSummaryVsCM ( )
private

Definition at line 1314 of file SiStripHitEffFromCalibTree.cc.

References ComputeEff(), gather_cfg::cout, layerfound_vsCM, and layertotal_vsCM.

Referenced by algoAnalyze().

1314  {
1315  cout<<"Computing efficiency vs CM"<<endl;
1317 }
void ComputeEff(vector< TH1F * > &vhfound, vector< TH1F * > &vhtotal, string name)
void SiStripHitEffFromCalibTree::makeSummaryVsLumi ( )
private

Definition at line 1283 of file SiStripHitEffFromCalibTree.cc.

References _showRings, ComputeEff(), gather_cfg::cout, layerfound_vsLumi, layerfound_vsPU, layertotal_vsLumi, layertotal_vsPU, and MuonTCMETValueMapProducer_cff::nLayers.

Referenced by algoAnalyze().

1283  {
1284  cout<<"Computing efficiency vs lumi"<<endl;
1285 
1286  unsigned int nLayers = 22;
1287  if(_showRings) nLayers = 20;
1288  unsigned int nLayersForAvg = 0;
1289  float layerLumi = 0;
1290  float layerPU = 0;
1291  float avgLumi = 0;
1292  float avgPU = 0;
1293 
1294  cout<<"Lumi summary: (avg over trajectory measurements)"<<endl;
1295  for(unsigned int ilayer=1; ilayer<nLayers; ilayer++) {
1296  layerLumi=layertotal_vsLumi[ilayer]->GetMean();
1297  layerPU=layertotal_vsPU[ilayer]->GetMean();
1298  //cout<<" layer "<<ilayer<<" lumi: "<<layerLumi<<" pu: "<<layerPU<<endl;
1299  if(layerLumi!=0 && layerPU!=0) {
1300  avgLumi+=layerLumi;
1301  avgPU+=layerPU;
1302  nLayersForAvg++;
1303  }
1304  }
1305  avgLumi/=nLayersForAvg;
1306  avgPU/=nLayersForAvg;
1307  cout<<"Avg conditions: lumi :"<<avgLumi<<" pu: "<<avgPU<<endl;
1308 
1311 
1312 }
void ComputeEff(vector< TH1F * > &vhfound, vector< TH1F * > &vhtotal, string name)
void SiStripHitEffFromCalibTree::makeTKMap ( )
private

Definition at line 863 of file SiStripHitEffFromCalibTree.cc.

References _title, _tkMapMin, BadModules, begin, gather_cfg::cout, TrackerMap::fill(), TrackerMap::fillc(), plotBeamSpotDB::first, mps_fire::i, createfilelist::int, layerfound, layertotal, modCounter, nModsMin, TrackerMap::save(), edm::second(), threshold, tkmap, tkmapbad, tkmapden, tkmapeff, and tkmapnum.

Referenced by algoAnalyze().

863  {
864  cout << "Entering TKMap generation!\n";
865  tkmap = new TrackerMap(" Detector Inefficiency ");
866  tkmapbad = new TrackerMap(" Inefficient Modules ");
867  tkmapeff = new TrackerMap(_title.Data());
868  tkmapnum = new TrackerMap(" Detector numerator ");
869  tkmapden = new TrackerMap(" Detector denominator ");
870 
871  double myeff, mynum, myden;
872 
873  for(Long_t i = 1; i <= 22; i++) {
874  //Loop over every layer, extracting the information from
875  //the map of the efficiencies
876  layertotal[i] = 0;
877  layerfound[i] = 0;
878  map<unsigned int, pair<unsigned int, unsigned int> >::const_iterator ih;
879  for( ih = modCounter[i].begin(); ih != modCounter[i].end(); ih++) {
880  //We should be in the layer in question, and looping over all of the modules in said layer
881  //Generate the list for the TKmap, and the bad module list
882  mynum = (double)(((*ih).second).second);
883  myden = (double)(((*ih).second).first);
884  if(myden>0) myeff = mynum/myden;
885  else myeff=0;
886  if ( (myden >= nModsMin) && (myeff < threshold) ) {
887  //We have a bad module, put it in the list!
888  BadModules[(*ih).first] = myeff;
889  tkmapbad->fillc((*ih).first,255,0,0);
890  cout << "Layer " << i << " module " << (*ih).first << " efficiency " << myeff << " " << (((*ih).second).second) << "/" << (((*ih).second).first) << endl;
891  }
892  else {
893  //Fill the bad list with empty results for every module
894  tkmapbad->fillc((*ih).first,255,255,255);
895  }
896  if(myden < 50 ) {
897  cout << "Module " << (*ih).first << " layer " << i << " is under occupancy at " << (((*ih).second).first) << endl;
898  }
899  //Put any module into the TKMap
900  //Should call module ID, and then 1- efficiency for that module
901  //if((*ih).first == 369137820) {
902  // cout << "Module 369137820 has 1-eff of " << 1.-myeff << endl;
903  //cout << "Which is " << ((*ih).second).second << "/" << ((*ih).second).first << endl;
904  //}
905  tkmap->fill((*ih).first,1.-myeff);
906  tkmapeff->fill((*ih).first,myeff);
907  tkmapnum->fill((*ih).first,mynum);
908  tkmapden->fill((*ih).first,myden);
909  //Find the total number of hits in the module
910  layertotal[i] += int(myden);
911  layerfound[i] += int(mynum);
912  }
913  }
914  tkmap->save(true, 0, 0, "SiStripHitEffTKMap.png");
915  tkmapbad->save(true, 0, 0, "SiStripHitEffTKMapBad.png");
916  tkmapeff->save(true, _tkMapMin, 1., "SiStripHitEffTKMapEff.png");
917  tkmapnum->save(true, 0, 0, "SiStripHitEffTKMapNum.png");
918  tkmapden->save(true, 0, 0, "SiStripHitEffTKMapDen.png");
919  cout << "Finished TKMap Generation\n";
920 }
U second(std::pair< T, U > const &p)
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Definition: TrackerMap.cc:698
map< unsigned int, pair< unsigned int, unsigned int > > modCounter[23]
void fillc(int idmod, int RGBcode)
Definition: TrackerMap.h:104
#define begin
Definition: vmac.h:30
map< unsigned int, double > BadModules
void fill(int layer, int ring, int nmod, float x)
Definition: TrackerMap.cc:2778
void SiStripHitEffFromCalibTree::SetBadComponents ( int  i,
int  component,
SiStripQuality::BadComponent BC,
std::stringstream  ssV[4][19],
int  NBadComponent[4][19][4] 
)
private

Definition at line 1370 of file SiStripHitEffFromCalibTree.cc.

References SiStripQuality::BadComponent::BadApvs, SiStripQuality::BadComponent::BadFibers, SiStripQuality::BadComponent::BadModule, DEFINE_FWK_MODULE, SiStripQuality::BadComponent::detid, SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(), mps_fire::i, and reader.

Referenced by algoAnalyze().

1370  {
1371 
1372  int napv=reader->getNumberOfApvsAndStripLength(BC.detid).first;
1373 
1374  ssV[i][component] << "\n\t\t "
1375  << BC.detid
1376  << " \t " << BC.BadModule << " \t "
1377  << ( (BC.BadFibers)&0x1 ) << " ";
1378  if (napv==4)
1379  ssV[i][component] << "x " <<( (BC.BadFibers>>1)&0x1 );
1380 
1381  if (napv==6)
1382  ssV[i][component] << ( (BC.BadFibers>>1)&0x1 ) << " "
1383  << ( (BC.BadFibers>>2)&0x1 );
1384  ssV[i][component] << " \t "
1385  << ( (BC.BadApvs)&0x1 ) << " "
1386  << ( (BC.BadApvs>>1)&0x1 ) << " ";
1387  if (napv==4)
1388  ssV[i][component] << "x x " << ( (BC.BadApvs>>2)&0x1 ) << " "
1389  << ( (BC.BadApvs>>3)&0x1 );
1390  if (napv==6)
1391  ssV[i][component] << ( (BC.BadApvs>>2)&0x1 ) << " "
1392  << ( (BC.BadApvs>>3)&0x1 ) << " "
1393  << ( (BC.BadApvs>>4)&0x1 ) << " "
1394  << ( (BC.BadApvs>>5)&0x1 ) << " ";
1395 
1396  if (BC.BadApvs){
1397  NBadComponent[i][0][2]+= ( (BC.BadApvs>>5)&0x1 )+ ( (BC.BadApvs>>4)&0x1 ) + ( (BC.BadApvs>>3)&0x1 ) +
1398  ( (BC.BadApvs>>2)&0x1 )+ ( (BC.BadApvs>>1)&0x1 ) + ( (BC.BadApvs)&0x1 );
1399  NBadComponent[i][component][2]+= ( (BC.BadApvs>>5)&0x1 )+ ( (BC.BadApvs>>4)&0x1 ) + ( (BC.BadApvs>>3)&0x1 ) +
1400  ( (BC.BadApvs>>2)&0x1 )+ ( (BC.BadApvs>>1)&0x1 ) + ( (BC.BadApvs)&0x1 );
1401  }
1402  if (BC.BadFibers){
1403  NBadComponent[i][0][1]+= ( (BC.BadFibers>>2)&0x1 )+ ( (BC.BadFibers>>1)&0x1 ) + ( (BC.BadFibers)&0x1 );
1404  NBadComponent[i][component][1]+= ( (BC.BadFibers>>2)&0x1 )+ ( (BC.BadFibers>>1)&0x1 ) + ( (BC.BadFibers)&0x1 );
1405  }
1406  if (BC.BadModule){
1407  NBadComponent[i][0][0]++;
1408  NBadComponent[i][component][0]++;
1409  }
1410 }
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
SiStripDetInfoFileReader * reader
void SiStripHitEffFromCalibTree::totalStatistics ( )
private

Definition at line 951 of file SiStripHitEffFromCalibTree.cc.

References gather_cfg::cout, mps_fire::i, layerfound, and layertotal.

Referenced by algoAnalyze().

951  {
952  //Calculate the statistics by layer
953  int totalfound = 0;
954  int totaltotal = 0;
955  double layereff;
956  int subdetfound[5];
957  int subdettotal[5];
958 
959  for(Long_t i=1; i<5; i++) {subdetfound[i]=0; subdettotal[i]=0;}
960 
961  for(Long_t i=1; i<=22; i++) {
962  layereff = double(layerfound[i])/double(layertotal[i]);
963  cout << "Layer " << i << " has total efficiency " << layereff << " " << layerfound[i] << "/" << layertotal[i] << endl;
964  totalfound += layerfound[i];
965  totaltotal += layertotal[i];
966  if(i<5) {subdetfound[1]+=layerfound[i]; subdettotal[1]+=layertotal[i];}
967  if(i>=5 && i<11) {subdetfound[2]+=layerfound[i]; subdettotal[2]+=layertotal[i];}
968  if(i>=11 && i<14) {subdetfound[3]+=layerfound[i]; subdettotal[3]+=layertotal[i];}
969  if(i>=14) {subdetfound[4]+=layerfound[i]; subdettotal[4]+=layertotal[i];}
970 
971  }
972 
973  cout << "The total efficiency is " << double(totalfound)/double(totaltotal) << endl;
974  cout << " TIB: " << double(subdetfound[1])/subdettotal[1] << endl;
975  cout << " TOB: " << double(subdetfound[2])/subdettotal[2] << endl;
976  cout << " TID: " << double(subdetfound[3])/subdettotal[3] << endl;
977  cout << " TEC: " << double(subdetfound[4])/subdettotal[4] << endl;
978 }

Member Data Documentation

string SiStripHitEffFromCalibTree::_badModulesFile
private

Definition at line 127 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

unsigned int SiStripHitEffFromCalibTree::_bunchx
private

Definition at line 132 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

unsigned int SiStripHitEffFromCalibTree::_clusterMatchingMethod
private

Definition at line 128 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_clusterTrajDist
private

Definition at line 130 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_effPlotMin
private

Definition at line 140 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_ResXSig
private

Definition at line 129 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_showEndcapSides
private

Definition at line 135 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_showOnlyGoodModules
private

Definition at line 138 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_showRings
private
bool SiStripHitEffFromCalibTree::_showTOB6TEC9
private
unsigned int SiStripHitEffFromCalibTree::_spaceBetweenTrains
private

Definition at line 133 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummaryVsBx(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_stripsApvEdge
private

Definition at line 131 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

TString SiStripHitEffFromCalibTree::_title
private
float SiStripHitEffFromCalibTree::_tkMapMin
private

Definition at line 139 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_useCM
private

Definition at line 134 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

int SiStripHitEffFromCalibTree::alllayerfound[35]
private

Definition at line 166 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

int SiStripHitEffFromCalibTree::alllayertotal[35]
private

Definition at line 165 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

map< unsigned int, double > SiStripHitEffFromCalibTree::BadModules
private

Definition at line 167 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSQLite(), and makeTKMap().

TTree* SiStripHitEffFromCalibTree::CalibTree
private

Definition at line 122 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze().

vector<string> SiStripHitEffFromCalibTree::CalibTreeFilenames
private

Definition at line 123 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

unsigned int SiStripHitEffFromCalibTree::doSummary
private

Definition at line 126 of file SiStripHitEffFromCalibTree.cc.

Referenced by SiStripHitEffFromCalibTree().

edm::FileInPath SiStripHitEffFromCalibTree::FileInPath_
private

Definition at line 118 of file SiStripHitEffFromCalibTree.cc.

Referenced by SiStripHitEffFromCalibTree().

edm::Service<TFileService> SiStripHitEffFromCalibTree::fs
private
int SiStripHitEffFromCalibTree::goodlayerfound[35]
private

Definition at line 164 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

int SiStripHitEffFromCalibTree::goodlayertotal[35]
private

Definition at line 163 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

vector<hit> SiStripHitEffFromCalibTree::hits[23]
private
vector<TH2F*> SiStripHitEffFromCalibTree::HotColdMaps
private

Definition at line 146 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeHotColdMaps().

int SiStripHitEffFromCalibTree::layerfound[23]
private

Definition at line 153 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap(), and totalStatistics().

map< unsigned int, vector<int> > SiStripHitEffFromCalibTree::layerfound_perBx
private

Definition at line 155 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

vector< TH1F* > SiStripHitEffFromCalibTree::layerfound_vsCM
private

Definition at line 161 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsCM().

vector< TH1F* > SiStripHitEffFromCalibTree::layerfound_vsLumi
private

Definition at line 157 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

vector< TH1F* > SiStripHitEffFromCalibTree::layerfound_vsPU
private

Definition at line 159 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

int SiStripHitEffFromCalibTree::layertotal[23]
private

Definition at line 154 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap(), and totalStatistics().

map< unsigned int, vector<int> > SiStripHitEffFromCalibTree::layertotal_perBx
private

Definition at line 156 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

vector< TH1F* > SiStripHitEffFromCalibTree::layertotal_vsCM
private

Definition at line 162 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsCM().

vector< TH1F* > SiStripHitEffFromCalibTree::layertotal_vsLumi
private

Definition at line 158 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

vector< TH1F* > SiStripHitEffFromCalibTree::layertotal_vsPU
private

Definition at line 160 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

map< unsigned int, pair< unsigned int, unsigned int> > SiStripHitEffFromCalibTree::modCounter[23]
private

Definition at line 147 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeTKMap().

unsigned int SiStripHitEffFromCalibTree::nModsMin
private
unsigned int SiStripHitEffFromCalibTree::nTEClayers
private
SiStripQuality* SiStripHitEffFromCalibTree::quality_
private
SiStripDetInfoFileReader* SiStripHitEffFromCalibTree::reader
private
float SiStripHitEffFromCalibTree::threshold
private
TrackerMap* SiStripHitEffFromCalibTree::tkmap
private

Definition at line 148 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapbad
private

Definition at line 149 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapden
private

Definition at line 152 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapeff
private

Definition at line 150 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapnum
private

Definition at line 151 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().