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 () override
 
- Public Member Functions inherited from ConditionDBWriter< SiStripBadStrip >
 ConditionDBWriter (const edm::ParameterSet &iConfig)
 
 ~ConditionDBWriter () override
 
- 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
 
 ~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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void algoAnalyze (const edm::Event &e, const edm::EventSetup &c) override
 
virtual void algoBeginJob ()
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 92 of file SiStripHitEffFromCalibTree.cc.

Constructor & Destructor Documentation

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

Definition at line 169 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.

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

Definition at line 200 of file SiStripHitEffFromCalibTree.cc.

200 { }

Member Function Documentation

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

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 212 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, triggerObjects_cff::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, TrapezoidalPlaneBounds::parameters(), edm::ESHandle< T >::product(), JetPlusTrackCorrections_cff::PU, jets_cff::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, globals_cff::x1, y, hit::y, z, and hit::z.

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

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

Reimplemented from ConditionDBWriter< SiStripBadStrip >.

Definition at line 207 of file SiStripHitEffFromCalibTree.cc.

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

Definition at line 1357 of file SiStripHitEffFromCalibTree.cc.

References phi, and Pi.

Referenced by makeHotColdMaps().

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

Definition at line 1248 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().

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

References _showRings, gen::k, and nTEClayers.

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

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

Definition at line 1318 of file SiStripHitEffFromCalibTree.cc.

References _showRings, gen::k, and nTEClayers.

Referenced by makeSummary().

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

Implements ConditionDBWriter< SiStripBadStrip >.

Definition at line 1340 of file SiStripHitEffFromCalibTree.cc.

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

1340  {
1341  //Need this for a Condition DB Writer
1342  //Initialize a return variable
1344 
1347 
1348  for(;rIter!=rIterEnd;++rIter){
1349  SiStripBadStrip::Range range(quality_->getDataVectorBegin()+rIter->ibegin,quality_->getDataVectorBegin()+rIter->iend);
1350  if ( ! obj->put(rIter->detid,range) )
1351  edm::LogError("SiStripHitEffFromCalibTree")<<"[SiStripHitEffFromCalibTree::getNewObject] detid already exists"<<std::endl;
1352  }
1353 
1354  return obj;
1355 }
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 732 of file SiStripHitEffFromCalibTree.cc.

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

Referenced by algoAnalyze().

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

Definition at line 921 of file SiStripHitEffFromCalibTree.cc.

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

Referenced by algoAnalyze().

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

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

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

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

Referenced by algoAnalyze().

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

Definition at line 1282 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().

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

Definition at line 862 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().

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

Definition at line 1369 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, reader, and globals_cff::x1.

Referenced by algoAnalyze().

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

Definition at line 950 of file SiStripHitEffFromCalibTree.cc.

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

Referenced by algoAnalyze().

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

Member Data Documentation

string SiStripHitEffFromCalibTree::_badModulesFile
private

Definition at line 126 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

unsigned int SiStripHitEffFromCalibTree::_bunchx
private

Definition at line 131 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

unsigned int SiStripHitEffFromCalibTree::_clusterMatchingMethod
private

Definition at line 127 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_clusterTrajDist
private

Definition at line 129 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_effPlotMin
private

Definition at line 139 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_ResXSig
private

Definition at line 128 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_showEndcapSides
private

Definition at line 134 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummary(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_showOnlyGoodModules
private

Definition at line 137 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 132 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSummaryVsBx(), and SiStripHitEffFromCalibTree().

float SiStripHitEffFromCalibTree::_stripsApvEdge
private

Definition at line 130 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

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

Definition at line 138 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap(), and SiStripHitEffFromCalibTree().

bool SiStripHitEffFromCalibTree::_useCM
private

Definition at line 133 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

int SiStripHitEffFromCalibTree::alllayerfound[35]
private

Definition at line 165 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

int SiStripHitEffFromCalibTree::alllayertotal[35]
private

Definition at line 164 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

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

Definition at line 166 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeSQLite(), and makeTKMap().

TTree* SiStripHitEffFromCalibTree::CalibTree
private

Definition at line 121 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze().

vector<string> SiStripHitEffFromCalibTree::CalibTreeFilenames
private

Definition at line 122 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and SiStripHitEffFromCalibTree().

unsigned int SiStripHitEffFromCalibTree::doSummary
private

Definition at line 125 of file SiStripHitEffFromCalibTree.cc.

Referenced by SiStripHitEffFromCalibTree().

edm::FileInPath SiStripHitEffFromCalibTree::FileInPath_
private

Definition at line 117 of file SiStripHitEffFromCalibTree.cc.

Referenced by SiStripHitEffFromCalibTree().

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

Definition at line 163 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

int SiStripHitEffFromCalibTree::goodlayertotal[35]
private

Definition at line 162 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummary().

vector<hit> SiStripHitEffFromCalibTree::hits[23]
private

Definition at line 144 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeHotColdMaps().

vector<TH2F*> SiStripHitEffFromCalibTree::HotColdMaps
private

Definition at line 145 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeHotColdMaps().

int SiStripHitEffFromCalibTree::layerfound[23]
private

Definition at line 152 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap(), and totalStatistics().

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

Definition at line 154 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

vector< TH1F* > SiStripHitEffFromCalibTree::layerfound_vsCM
private

Definition at line 160 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsCM().

vector< TH1F* > SiStripHitEffFromCalibTree::layerfound_vsLumi
private

Definition at line 156 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

vector< TH1F* > SiStripHitEffFromCalibTree::layerfound_vsPU
private

Definition at line 158 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

int SiStripHitEffFromCalibTree::layertotal[23]
private

Definition at line 153 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap(), and totalStatistics().

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

Definition at line 155 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsBx().

vector< TH1F* > SiStripHitEffFromCalibTree::layertotal_vsCM
private

Definition at line 161 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsCM().

vector< TH1F* > SiStripHitEffFromCalibTree::layertotal_vsLumi
private

Definition at line 157 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

vector< TH1F* > SiStripHitEffFromCalibTree::layertotal_vsPU
private

Definition at line 159 of file SiStripHitEffFromCalibTree.cc.

Referenced by algoAnalyze(), and makeSummaryVsLumi().

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

Definition at line 146 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 147 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapbad
private

Definition at line 148 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapden
private

Definition at line 151 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapeff
private

Definition at line 149 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().

TrackerMap* SiStripHitEffFromCalibTree::tkmapnum
private

Definition at line 150 of file SiStripHitEffFromCalibTree.cc.

Referenced by makeTKMap().