CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
TrackerOfflineValidationSummary Class Reference

#include <Alignment/TrackerOfflineValidationSummary/src/TrackerOfflineValidationSummary.cc>

Inheritance diagram for TrackerOfflineValidationSummary:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  HarvestingHierarchy
 
struct  HarvestingHistos
 Put here the histograms created during harvesting. More...
 
struct  ModuleHistos
 

Public Member Functions

 TrackerOfflineValidationSummary (const edm::ParameterSet &)
 
 ~TrackerOfflineValidationSummary ()
 
- 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
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &) override
 
void applyHarvestingHierarchy (TTree &treeMem)
 
const std::string associateModuleHistsWithTree (const TkOffTreeVariables &treeMem, TrackerOfflineValidationSummary::ModuleHistos &moduleHists, std::map< std::string, std::string > &substructureName)
 
void bookHarvestingHists ()
 
void collateHarvestingHists (TTree &tree)
 
virtual void endJob () override
 
void fillHarvestingHists (TTree &tree)
 
void fillTree (TTree &tree, std::map< int, TrackerOfflineValidationSummary::ModuleHistos > &moduleHist, TkOffTreeVariables &treeMem, const TrackerGeometry &tkgeom, std::map< std::string, std::string > &substructureName, const TrackerTopology *tTopo)
 
std::pair< float, float > fitResiduals (TH1 *hist) const
 
void getBinning (const std::string &binningPSetName, int &nBinsX, double &lowerBoundX, double &upperBoundX) const
 
float getMedian (const TH1 *hist) const
 

Private Attributes

DQMStoredbe_
 
const edm::EventSetuplastSetup_
 
const std::string moduleDirectory_
 
bool moduleMapsInitialized
 
std::map< int,
TrackerOfflineValidationSummary::ModuleHistos
mPxbResiduals_
 
std::map< int,
TrackerOfflineValidationSummary::ModuleHistos
mPxeResiduals_
 
std::map< int,
TrackerOfflineValidationSummary::ModuleHistos
mTecResiduals_
 
std::map< int,
TrackerOfflineValidationSummary::ModuleHistos
mTibResiduals_
 
std::map< int,
TrackerOfflineValidationSummary::ModuleHistos
mTidResiduals_
 
std::map< int,
TrackerOfflineValidationSummary::ModuleHistos
mTobResiduals_
 
const edm::ParameterSet parSet_
 
edm::ESHandle< TrackerGeometrytkGeom_
 
const bool useFit_
 
std::vector< HarvestingHierarchyvHarvestingHierarchy_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 63 of file TrackerOfflineValidationSummary.cc.

Constructor & Destructor Documentation

TrackerOfflineValidationSummary::TrackerOfflineValidationSummary ( const edm::ParameterSet iConfig)
explicit
TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary ( )

Definition at line 164 of file TrackerOfflineValidationSummary.cc.

165 {
166 
167  // do anything here that needs to be done at desctruction time
168  // (e.g. close files, deallocate resources etc.)
169 
170 }

Member Function Documentation

void TrackerOfflineValidationSummary::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 179 of file TrackerOfflineValidationSummary.cc.

References DetId::det(), TrackerGeometry::detIds(), edm::hlt::Exception, edm::EventSetup::get(), lastSetup_, moduleMapsInitialized, mPxbResiduals_, mPxeResiduals_, mTecResiduals_, mTibResiduals_, mTidResiduals_, mTobResiduals_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::rawId(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, tkGeom_, and StripSubdetector::TOB.

180 {
181  lastSetup_ = &iSetup;
182 
183  // Access of EventSetup is needed to get the list of silicon-modules and their IDs
184  // Since they do not change, it is accessed only once
185  if(moduleMapsInitialized)return;
186  iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom_ );
187  const TrackerGeometry* bareTkGeomPtr = &(*tkGeom_);
188  const TrackingGeometry::DetIdContainer& detIdContainer = bareTkGeomPtr->detIds();
189  std::vector<DetId>::const_iterator iDet;
190  for(iDet = detIdContainer.begin(); iDet != detIdContainer.end(); ++iDet){
191  const DetId& detId = *iDet;
192  const uint32_t rawId = detId.rawId();
193  const unsigned int subdetId = detId.subdetId();
194  if (subdetId == PixelSubdetector::PixelBarrel) mPxbResiduals_[rawId];
195  else if(subdetId == PixelSubdetector::PixelEndcap) mPxeResiduals_[rawId];
196  else if(subdetId == StripSubdetector::TIB) mTibResiduals_[rawId];
197  else if(subdetId == StripSubdetector::TID) mTidResiduals_[rawId];
198  else if(subdetId == StripSubdetector::TOB) mTobResiduals_[rawId];
199  else if(subdetId == StripSubdetector::TEC) mTecResiduals_[rawId];
200  else {
201  throw cms::Exception("Geometry Error")
202  << "[TrackerOfflineValidationSummary] Error, tried to get reference for non-tracker subdet " << subdetId
203  << " from detector " << detId.det();
204  }
205  }
206  moduleMapsInitialized = true;
207 }
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxbResiduals_
edm::ESHandle< TrackerGeometry > tkGeom_
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTibResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTobResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxeResiduals_
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTidResiduals_
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTecResiduals_
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
std::vector< DetId > DetIdContainer
void TrackerOfflineValidationSummary::applyHarvestingHierarchy ( TTree &  treeMem)
private

Definition at line 668 of file TrackerOfflineValidationSummary.cc.

References bookHarvestingHists(), TkOffTreeVariables::isDoubleSide, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TkOffTreeVariables::side, AlCaHLTBitMon_QueryRunRegistry::string, TkOffTreeVariables::subDetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and vHarvestingHierarchy_.

Referenced by collateHarvestingHists().

669 {
670  TkOffTreeVariables *treeMemPtr = 0;
671  std::map<std::string,std::string> *substructureName = 0;
672  tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr);
673  tree.SetBranchAddress("SubstructureName", &substructureName);
674 
675  // Loop over modules to select accumulation criteria for harvesting plots
676  for(unsigned int iSubdet = 1; iSubdet<7; ++iSubdet){
677  std::string hierarchyName("");
678  std::string componentName("");
679  std::vector<unsigned int> treeEntries;
680  for(unsigned int iSide = 1; iSide<3; ++iSide){
681  // Set up only one collection for Barrels, not separated for side
682  if(iSide==1 && (iSubdet==PixelSubdetector::PixelBarrel || iSubdet==StripSubdetector::TIB || iSubdet==StripSubdetector::TOB))continue;
683  for(int iTree=0; iTree<tree.GetEntries(); ++iTree){
684  tree.GetEntry(iTree);
685  // Do not use glued Dets
686  if(treeMemPtr->isDoubleSide)continue;
687  if(treeMemPtr->subDetId == iSubdet){
688  if(iSide!=treeMemPtr->side && (iSubdet==PixelSubdetector::PixelEndcap || iSubdet==StripSubdetector::TID || iSubdet==StripSubdetector::TEC))continue;
689  treeEntries.push_back(iTree);
690  if(hierarchyName.length() == 0){
691  hierarchyName = (*substructureName)["subdet"];
692  componentName = (*substructureName)["component"];
693  }
694  }
695  }
696  HarvestingHierarchy harvestingHierarchy(hierarchyName,componentName,treeEntries);
697  vHarvestingHierarchy_.push_back(harvestingHierarchy);
698  hierarchyName = ""; componentName = ""; treeEntries.clear();
699  }
700  }
701  // Here could be a further separation of the HarvestingHierarchy.
702  // E.g. separate the existing ones by layer and add them to the vector without deleting any element from the vector.
703  // The existing hists will stay and the new ones are added
704 
705  // Now, book the corresponding histos
706  this->bookHarvestingHists();
707 }
container to hold data to be written into TTree
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
const std::string TrackerOfflineValidationSummary::associateModuleHistsWithTree ( const TkOffTreeVariables treeMem,
TrackerOfflineValidationSummary::ModuleHistos moduleHists,
std::map< std::string, std::string > &  substructureName 
)
private

Definition at line 473 of file TrackerOfflineValidationSummary.cc.

References TkOffTreeVariables::blade, dbe_, contentValuesFiles::fullPath, DQMStore::get(), MonitorElement::getTH1(), TkOffTreeVariables::half, TkOffTreeVariables::isDoubleSide, TkOffTreeVariables::layer, TkOffTreeVariables::module, moduleDirectory_, TkOffTreeVariables::moduleId, TrackerOfflineValidationSummary::ModuleHistos::NormResHisto, TrackerOfflineValidationSummary::ModuleHistos::NormResXprimeHisto, TrackerOfflineValidationSummary::ModuleHistos::NormResYprimeHisto, TkOffTreeVariables::outerInner, TkOffTreeVariables::panel, TkOffTreeVariables::petal, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TrackerOfflineValidationSummary::ModuleHistos::ResHisto, TrackerOfflineValidationSummary::ModuleHistos::ResXprimeHisto, TrackerOfflineValidationSummary::ModuleHistos::ResYprimeHisto, relativeConstraints::ring, TkOffTreeVariables::ring, TkOffTreeVariables::rod, TkOffTreeVariables::side, AlCaHLTBitMon_QueryRunRegistry::string, TkOffTreeVariables::subDetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by fillTree().

473  {
474  std::stringstream histDir, sSubdetName;
475  std::string componentName;
476  if(moduleDirectory_.length() != 0)histDir<<moduleDirectory_<<"/";
477  std::string wheelOrLayer("_layer_");
479  unsigned int half(treeMem.half), layer(treeMem.layer), ladder(0);
480  if(layer==1){
481  if(half==2)ladder = treeMem.rod -5;
482  else if(treeMem.rod>15)ladder = treeMem.rod -10;
483  else ladder = treeMem.rod;
484  }else if(layer==2){
485  if(half==2)ladder = treeMem.rod -8;
486  else if(treeMem.rod>24)ladder = treeMem.rod -16;
487  else ladder = treeMem.rod;
488  }else if(layer==3){
489  if(half==2)ladder = treeMem.rod -11;
490  else if(treeMem.rod>33)ladder = treeMem.rod -22;
491  else ladder = treeMem.rod;
492  }
493  componentName = "Pixel";
494  sSubdetName<<"TPBBarrel_1";
495  histDir<<componentName<<"/"<<sSubdetName.str()<<"/TPBHalfBarrel_"<<treeMem.half<<"/TPBLayer_"<<treeMem.layer<<"/TPBLadder_"<<ladder;
496  }else if(treeMem.subDetId == PixelSubdetector::PixelEndcap){
497  unsigned int side(treeMem.side), half(treeMem.half), blade(0);
498  if(side==1)side=3;
499  if(half==2)blade = treeMem.blade -6;
500  else if(treeMem.blade>18)blade = treeMem.blade -12;
501  else blade = treeMem.blade;
502  componentName = "Pixel";
503  sSubdetName<<"TPEEndcap_"<<side;
504  histDir<<componentName<<"/"<<sSubdetName.str()<<"/TPEHalfCylinder_"<<treeMem.half<<"/TPEHalfDisk_"<<treeMem.layer<<"/TPEBlade_"<<blade<<"/TPEPanel_"<<treeMem.panel;
505  wheelOrLayer = "_wheel_";
506  }else if(treeMem.subDetId == StripSubdetector::TIB){
507  unsigned int half(treeMem.half), layer(treeMem.layer), surface(treeMem.outerInner), string(0);
508  if(half==2){
509  if(layer==1){
510  if(surface==1)string = treeMem.rod -13;
511  else if(surface==2)string = treeMem.rod -15;
512  }
513  if(layer==2){
514  if(surface==1)string = treeMem.rod -17;
515  else if(surface==2)string = treeMem.rod -19;
516  }
517  if(layer==3){
518  if(surface==1)string = treeMem.rod -22;
519  else if(surface==2)string = treeMem.rod -23;
520  }
521  if(layer==4){
522  if(surface==1)string = treeMem.rod -26;
523  else if(surface==2)string = treeMem.rod -28;
524  }
525  }
526  else string = treeMem.rod;
527  std::stringstream detString;
528  if(treeMem.layer<3 && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module;
529  else detString<<"";
530  componentName = "Strip";
531  sSubdetName<<"TIBBarrel_1";
532  histDir<<componentName<<"/"<<sSubdetName.str()<<"/TIBHalfBarrel_"<<treeMem.side<<"/TIBLayer_"<<treeMem.layer<<"/TIBHalfShell_"<<treeMem.half<<"/TIBSurface_"<<treeMem.outerInner<<"/TIBString_"<<string<<detString.str();
533  }else if(treeMem.subDetId == StripSubdetector::TID){
534  unsigned int side(treeMem.side), outerInner(0);
535  if(side==1)side=3;
536  if(treeMem.outerInner==1)outerInner=2;
537  else if(treeMem.outerInner==2)outerInner=1;
538  std::stringstream detString;
539  if(treeMem.ring<3 && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module;
540  else detString<<"";
541  componentName = "Strip";
542  sSubdetName<<"TIDEndcap_"<<side;
543  histDir<<componentName<<"/"<<sSubdetName.str()<<"/TIDDisk_"<<treeMem.layer<<"/TIDRing_"<<treeMem.ring<<"/TIDSide_"<<outerInner<<detString.str();
544  wheelOrLayer = "_wheel_";
545  }else if(treeMem.subDetId == StripSubdetector::TOB){
546  std::stringstream detString;
547  if(treeMem.layer<3 && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module;
548  else detString<<"";
549  componentName = "Strip";
550  sSubdetName<<"TOBBarrel_4";
551  histDir<<componentName<<"/"<<sSubdetName.str()<<"/TOBHalfBarrel_"<<treeMem.side<<"/TOBLayer_"<<treeMem.layer<<"/TOBRod_"<<treeMem.rod<<detString.str();
552  }else if(treeMem.subDetId == StripSubdetector::TEC) {
553  unsigned int side(0), outerInner(0), ring(0);
554  if(treeMem.side==1)side=6;
555  else if(treeMem.side==2)side=5;
556  if(treeMem.outerInner==1)outerInner = 2;
557  else if(treeMem.outerInner==2)outerInner=1;
558  if(treeMem.layer>3 && treeMem.layer<7)ring = treeMem.ring -1;
559  else if(treeMem.layer==7 || treeMem.layer==8)ring = treeMem.ring -2;
560  else if(treeMem.layer==9)ring = treeMem.ring -3;
561  else ring = treeMem.ring;
562  std::stringstream detString;
563  if((treeMem.ring<3 || treeMem.ring==5) && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module;
564  else detString<<"";
565  componentName = "Strip";
566  sSubdetName<<"TECEndcap_"<<side;
567  histDir<<componentName<<"/"<<sSubdetName.str()<<"/TECDisk_"<<treeMem.layer<<"/TECSide_"<<outerInner<<"/TECPetal_"<<treeMem.petal<<"/TECRing_"<<ring<<detString.str();
568  wheelOrLayer = "_wheel_";
569  }
570 
571  substructureName["component"] = componentName;
572  substructureName["subdet"] = sSubdetName.str();
573 
574  std::stringstream histName;
575  histName<<"residuals_subdet_"<<treeMem.subDetId<<wheelOrLayer<<treeMem.layer<<"_module_"<<treeMem.moduleId;
576 
578  fullPath = histDir.str()+"/h_xprime_"+histName.str();
579  if(dbe_->get(fullPath)) moduleHists.ResXprimeHisto = dbe_->get(fullPath)->getTH1();
580  else{edm::LogError("TrackerOfflineValidationSummary")<<"Problem with names in input file produced in TrackerOfflineValidation ...\n"
581  <<"This histogram should exist in every configuration, "
582  <<"but no histogram with name "<<fullPath<<" is found!";
583  return "";
584  }
585  fullPath = histDir.str()+"/h_normxprime"+histName.str();
586  if(dbe_->get(fullPath)) moduleHists.NormResXprimeHisto = dbe_->get(fullPath)->getTH1();
587  fullPath = histDir.str()+"/h_yprime_"+histName.str();
588  if(dbe_->get(fullPath)) moduleHists.ResYprimeHisto = dbe_->get(fullPath)->getTH1();
589  fullPath = histDir.str()+"/h_normyprime"+histName.str();
590  if(dbe_->get(fullPath)) moduleHists.NormResYprimeHisto = dbe_->get(fullPath)->getTH1();
591  fullPath = histDir.str()+"/h_"+histName.str();
592  if(dbe_->get(fullPath)) moduleHists.ResHisto = dbe_->get(fullPath)->getTH1();
593  fullPath = histDir.str()+"/h_norm"+histName.str();
594  if(dbe_->get(fullPath)) moduleHists.NormResHisto = dbe_->get(fullPath)->getTH1();
595 
596  return histDir.str();
597 }
TH1 * getTH1(void) const
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1696
void TrackerOfflineValidationSummary::bookHarvestingHists ( )
private

Definition at line 711 of file TrackerOfflineValidationSummary.cc.

References DQMStore::book1D(), dbe_, getBinning(), edm::ParameterSet::getParameter(), moduleDirectory_, parSet_, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and vHarvestingHierarchy_.

Referenced by applyHarvestingHierarchy().

712 {
713  edm::LogInfo("TrackerOfflineValidationSummary")<<"Harvesting histograms will be booked for "<<vHarvestingHierarchy_.size()<<" different hierarchy selections";
714  for(std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin(); iHier != vHarvestingHierarchy_.end(); ++iHier){
715 
716  std::stringstream dmrXprimeHistoName, dmrYprimeHistoName, dmrXprimeHistoTitle, dmrYprimeHistoTitle;
717  dmrXprimeHistoName << "h_DmrXprime_" << iHier->hierarchyName;
718  dmrYprimeHistoName << "h_DmrYprime_" << iHier->hierarchyName;
719  dmrXprimeHistoTitle<< "DMR for " << iHier->hierarchyName <<";<#DeltaX> [cm];# modules";
720  dmrYprimeHistoTitle<< "DMR for " << iHier->hierarchyName <<";<#DeltaY> [cm];# modules";
721 
722  std::string directoryString(moduleDirectory_);
723  if(directoryString.length()!=0)directoryString += "/";
724  directoryString += iHier->componentName;
725  dbe_->setCurrentFolder(directoryString);
726 
727  int nBinsX(0); double xMin(0.), xMax(0.);
728  if(iHier->componentName == "Pixel"){
729  this->getBinning("TH1DmrXprimePixelModules",nBinsX,xMin,xMax);
730  iHier->harvestingHistos.DmrXprime = dbe_->book1D(dmrXprimeHistoName.str(),dmrXprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
731  this->getBinning("TH1DmrYprimePixelModules",nBinsX,xMin,xMax);
732  iHier->harvestingHistos.DmrYprime = dbe_->book1D(dmrYprimeHistoName.str(),dmrYprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
733  }
734  else if(iHier->componentName == "Strip"){
735  this->getBinning("TH1DmrXprimeStripModules",nBinsX,xMin,xMax);
736  iHier->harvestingHistos.DmrXprime = dbe_->book1D(dmrXprimeHistoName.str(),dmrXprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
737  if(!parSet_.getParameter<bool>("stripYDmrs"))continue;
738  this->getBinning("TH1DmrYprimeStripModules",nBinsX,xMin,xMax);
739  iHier->harvestingHistos.DmrYprime = dbe_->book1D(dmrYprimeHistoName.str(),dmrYprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
740  }
741  }
742 }
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
void getBinning(const std::string &binningPSetName, int &nBinsX, double &lowerBoundX, double &upperBoundX) const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void TrackerOfflineValidationSummary::collateHarvestingHists ( TTree &  tree)
private

Definition at line 660 of file TrackerOfflineValidationSummary.cc.

References applyHarvestingHierarchy(), and fillHarvestingHists().

Referenced by endJob().

void TrackerOfflineValidationSummary::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 212 of file TrackerOfflineValidationSummary.cc.

References collateHarvestingHists(), fillTree(), edm::EventSetup::get(), lastSetup_, mPxbResiduals_, mPxeResiduals_, mTecResiduals_, mTibResiduals_, mTidResiduals_, mTobResiduals_, edm::ESHandle< class >::product(), tkGeom_, and diffTreeTool::tree.

213 {
214  //Retrieve tracker topology from geometry
215  edm::ESHandle<TrackerTopology> tTopoHandle;
216  lastSetup_->get<IdealGeometryRecord>().get(tTopoHandle);
217  const TrackerTopology* const tTopo = tTopoHandle.product();
218 
219  AlignableTracker aliTracker(&(*tkGeom_), tTopo);
220 
221  TTree* tree = new TTree("TkOffVal","TkOffVal");
222 
223  TkOffTreeVariables *treeMemPtr = new TkOffTreeVariables;
224  // We create branches for all members of 'TkOffTreeVariables' (even if not needed).
225  // This works because we have a dictionary for 'TkOffTreeVariables'
226  // (see src/classes_def.xml and src/classes.h):
227  tree->Branch("TkOffTreeVariables", &treeMemPtr); // address of pointer!
228  // second branch needed for assigning names and titles to harvesting histograms consistent to others
229  std::map<std::string,std::string> *substructureName = new std::map<std::string,std::string>;
230  tree->Branch("SubstructureName", &substructureName, 32000, 00); // SplitLevel must be set to zero
231 
232 
233  this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
234  this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
235  this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
236  this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
237  this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
238  this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName, tTopo);
239 
240  //dbe_->showDirStructure();
241  //dbe_->save("dqmOut.root");
242 
243  // Method for filling histograms which show summarized values (mean, rms, median ...)
244  // of the module-based histograms from TrackerOfflineValidation
245  this->collateHarvestingHists(*tree);
246 
247  delete tree; tree = 0;
248  delete treeMemPtr; treeMemPtr = 0;
249  delete substructureName; substructureName = 0;
250 }
container to hold data to be written into TTree
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxbResiduals_
edm::ESHandle< TrackerGeometry > tkGeom_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTibResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTobResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxeResiduals_
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTidResiduals_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTecResiduals_
void fillTree(TTree &tree, std::map< int, TrackerOfflineValidationSummary::ModuleHistos > &moduleHist, TkOffTreeVariables &treeMem, const TrackerGeometry &tkgeom, std::map< std::string, std::string > &substructureName, const TrackerTopology *tTopo)
void TrackerOfflineValidationSummary::fillHarvestingHists ( TTree &  tree)
private

Definition at line 756 of file TrackerOfflineValidationSummary.cc.

References TkOffTreeVariables::entries, edm::ParameterSet::getParameter(), TkOffTreeVariables::medianX, TkOffTreeVariables::medianY, parSet_, and vHarvestingHierarchy_.

Referenced by collateHarvestingHists().

757 {
758  TkOffTreeVariables *treeMemPtr = 0;
759  std::map<std::string,std::string> *substructureName = 0;
760  tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr);
761  tree.SetBranchAddress("SubstructureName", &substructureName);
762 
763  const unsigned int minEntriesPerModule(parSet_.getParameter<unsigned int>("minEntriesPerModuleForDmr"));
764  edm::LogInfo("TrackerOfflineValidationSummary")<<"Median of a module is added to DMR plots if it contains at least "<<minEntriesPerModule<<" hits";
765 
766  for(std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin(); iHier != vHarvestingHierarchy_.end(); ++iHier){
767  for(std::vector<unsigned int>::const_iterator iTreeEntries = iHier->treeEntries.begin(); iTreeEntries != iHier->treeEntries.end(); ++iTreeEntries){
768  tree.GetEntry(*iTreeEntries);
769  if(treeMemPtr->entries < minEntriesPerModule)continue;
770  iHier->harvestingHistos.DmrXprime->Fill(treeMemPtr->medianX);
771  if(iHier->harvestingHistos.DmrYprime)iHier->harvestingHistos.DmrYprime->Fill(treeMemPtr->medianY);
772  }
773  }
774 }
T getParameter(std::string const &) const
container to hold data to be written into TTree
std::vector< HarvestingHierarchy > vHarvestingHierarchy_
void TrackerOfflineValidationSummary::fillTree ( TTree &  tree,
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > &  moduleHist,
TkOffTreeVariables treeMem,
const TrackerGeometry tkgeom,
std::map< std::string, std::string > &  substructureName,
const TrackerTopology tTopo 
)
private

Definition at line 254 of file TrackerOfflineValidationSummary.cc.

References associateModuleHistsWithTree(), TkOffTreeVariables::blade, TkOffTreeVariables::chi2PerDofX, TkOffTreeVariables::chi2PerDofY, TkOffTreeVariables::clear(), dbe_, SiPixelRawToDigiRegional_cfi::deltaPhi, dPhi(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, TkOffTreeVariables::entries, PV3DBase< T, PVType, FrameType >::eta(), TkOffTreeVariables::fitMeanNormX, TkOffTreeVariables::fitMeanNormY, TkOffTreeVariables::fitMeanX, TkOffTreeVariables::fitMeanY, fitResiduals(), TkOffTreeVariables::fitSigmaNormX, TkOffTreeVariables::fitSigmaNormY, TkOffTreeVariables::fitSigmaX, TkOffTreeVariables::fitSigmaY, getMedian(), edm::ParameterSet::getParameter(), h, TkOffTreeVariables::half, TkOffTreeVariables::histNameLocalX, TkOffTreeVariables::histNameNormLocalX, TkOffTreeVariables::histNameNormX, TkOffTreeVariables::histNameNormY, TkOffTreeVariables::histNameX, TkOffTreeVariables::histNameY, TrackerGeometry::idToDet(), TkOffTreeVariables::isDoubleSide, TkOffTreeVariables::isStereo, TkOffTreeVariables::layer, TkOffTreeVariables::meanLocalX, TkOffTreeVariables::meanNormLocalX, TkOffTreeVariables::meanNormX, TkOffTreeVariables::meanNormY, TkOffTreeVariables::meanX, TkOffTreeVariables::meanY, TkOffTreeVariables::medianX, TkOffTreeVariables::medianY, TkOffTreeVariables::module, TkOffTreeVariables::moduleId, TkOffTreeVariables::numberOfOutliers, TkOffTreeVariables::numberOfOverflows, TkOffTreeVariables::numberOfUnderflows, TkOffTreeVariables::outerInner, TkOffTreeVariables::panel, parSet_, PV3DBase< T, PVType, FrameType >::perp(), TkOffTreeVariables::petal, PV3DBase< T, PVType, FrameType >::phi(), TkOffTreeVariables::phiDirection, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, TkOffTreeVariables::posEta, GeomDet::position(), TkOffTreeVariables::posPhi, TkOffTreeVariables::posR, TkOffTreeVariables::posX, TkOffTreeVariables::posY, TkOffTreeVariables::posZ, TrackerTopology::pxbLadder(), TrackerTopology::pxbLayer(), TrackerTopology::pxbModule(), TrackerTopology::pxfBlade(), TrackerTopology::pxfDisk(), TrackerTopology::pxfModule(), TrackerTopology::pxfPanel(), TrackerTopology::pxfSide(), DetId::rawId(), TkOffTreeVariables::rDirection, DQMStore::removeElement(), TkOffTreeVariables::ring, TkOffTreeVariables::rmsLocalX, TkOffTreeVariables::rmsNormLocalX, TkOffTreeVariables::rmsNormX, TkOffTreeVariables::rmsNormY, TkOffTreeVariables::rmsX, TkOffTreeVariables::rmsY, TkOffTreeVariables::rod, TkOffTreeVariables::rOrZDirection, DQMStore::setCurrentFolder(), TkOffTreeVariables::side, AlCaHLTBitMon_QueryRunRegistry::string, DetId::subdetId(), TkOffTreeVariables::subDetId, GeomDet::surface(), StripSubdetector::TEC, TrackerTopology::tecIsDoubleSide(), TrackerTopology::tecModule(), TrackerTopology::tecPetalInfo(), TrackerTopology::tecRing(), TrackerTopology::tecSide(), TrackerTopology::tecStereo(), TrackerTopology::tecWheel(), StripSubdetector::TIB, TrackerTopology::tibIsDoubleSide(), TrackerTopology::tibLayer(), TrackerTopology::tibModule(), TrackerTopology::tibStereo(), TrackerTopology::tibStringInfo(), StripSubdetector::TID, TrackerTopology::tidIsDoubleSide(), TrackerTopology::tidModuleInfo(), TrackerTopology::tidRing(), TrackerTopology::tidSide(), TrackerTopology::tidStereo(), TrackerTopology::tidWheel(), StripSubdetector::TOB, TrackerTopology::tobIsDoubleSide(), TrackerTopology::tobLayer(), TrackerTopology::tobModule(), TrackerTopology::tobRodInfo(), TrackerTopology::tobStereo(), Surface::toGlobal(), useFit_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and TkOffTreeVariables::zDirection.

Referenced by endJob().

258 {
259  for(std::map<int, TrackerOfflineValidationSummary::ModuleHistos>::iterator it = moduleHist.begin(),
260  itEnd= moduleHist.end(); it != itEnd;++it ) {
261  treeMem.clear(); // make empty/default
262 
263  //variables concerning the tracker components/hierarchy levels
264  const DetId detId = it->first;
265  treeMem.moduleId = detId;
266  treeMem.subDetId = detId.subdetId();
267 
269 
270  unsigned int whichHalfBarrel(1), rawId(detId.rawId()); //DetId does not know about halfBarrels is PXB ...
271  if( (rawId>=302056964 && rawId<302059300) || (rawId>=302123268 && rawId<302127140) || (rawId>=302189572 && rawId<302194980) )whichHalfBarrel=2;
272  treeMem.layer = tTopo->pxbLayer(detId);
273  treeMem.half = whichHalfBarrel;
274  treeMem.rod = tTopo->pxbLadder(detId); // ... so, ladder is not per halfBarrel-Layer, but per barrel-layer! Needs complicated calculation in associateModuleHistsWithTree()
275  treeMem.module = tTopo->pxbModule(detId);
276  } else if(treeMem.subDetId == PixelSubdetector::PixelEndcap){
277 
278  unsigned int whichHalfCylinder(1), rawId(detId.rawId()); //DetId does not kmow about halfCylinders in PXF
279  if( (rawId>=352394500 && rawId<352406032) || (rawId>=352460036 && rawId<352471568) || (rawId>=344005892 && rawId<344017424) || (rawId>=344071428 && rawId<344082960) )whichHalfCylinder=2;
280  treeMem.layer = tTopo->pxfDisk(detId);
281  treeMem.side = tTopo->pxfSide(detId);
282  treeMem.half = whichHalfCylinder;
283  treeMem.blade = tTopo->pxfBlade(detId);
284  treeMem.panel = tTopo->pxfPanel(detId);
285  treeMem.module = tTopo->pxfModule(detId);
286  } else if(treeMem.subDetId == StripSubdetector::TIB){
287 
288  unsigned int whichHalfShell(1), rawId(detId.rawId()); //DetId does not kmow about halfShells in TIB
289  if ( (rawId>=369120484 && rawId<369120688) || (rawId>=369121540 && rawId<369121776) || (rawId>=369136932 && rawId<369137200) || (rawId>=369137988 && rawId<369138288) ||
290  (rawId>=369153396 && rawId<369153744) || (rawId>=369154436 && rawId<369154800) || (rawId>=369169844 && rawId<369170256) || (rawId>=369170900 && rawId<369171344) ||
291  (rawId>=369124580 && rawId<369124784) || (rawId>=369125636 && rawId<369125872) || (rawId>=369141028 && rawId<369141296) || (rawId>=369142084 && rawId<369142384) ||
292  (rawId>=369157492 && rawId<369157840) || (rawId>=369158532 && rawId<369158896) || (rawId>=369173940 && rawId<369174352) || (rawId>=369174996 && rawId<369175440) ) whichHalfShell=2;
293  treeMem.layer = tTopo->tibLayer(detId);
294  treeMem.side = tTopo->tibStringInfo(detId)[0];
295  treeMem.half = whichHalfShell;
296  treeMem.rod = tTopo->tibStringInfo(detId)[2];
297  treeMem.outerInner = tTopo->tibStringInfo(detId)[1];
298  treeMem.module = tTopo->tibModule(detId);
299  treeMem.isStereo = tTopo->tibStereo(detId);
300  treeMem.isDoubleSide = tTopo->tibIsDoubleSide(detId);
301  } else if(treeMem.subDetId == StripSubdetector::TID){
302 
303  treeMem.layer = tTopo->tidWheel(detId);
304  treeMem.side = tTopo->tidSide(detId);
305  treeMem.ring = tTopo->tidRing(detId);
306  treeMem.outerInner = tTopo->tidModuleInfo(detId)[0];
307  treeMem.module = tTopo->tidModuleInfo(detId)[1];
308  treeMem.isStereo = tTopo->tidStereo(detId);
309  treeMem.isDoubleSide = tTopo->tidIsDoubleSide(detId);
310  } else if(treeMem.subDetId == StripSubdetector::TOB){
311 
312  treeMem.layer = tTopo->tobLayer(detId);
313  treeMem.side = tTopo->tobRodInfo(detId)[0];
314  treeMem.rod = tTopo->tobRodInfo(detId)[1];
315  treeMem.module = tTopo->tobModule(detId);
316  treeMem.isStereo = tTopo->tobStereo(detId);
317  treeMem.isDoubleSide = tTopo->tobIsDoubleSide(detId);
318  } else if(treeMem.subDetId == StripSubdetector::TEC) {
319 
320  treeMem.layer = tTopo->tecWheel(detId);
321  treeMem.side = tTopo->tecSide(detId);
322  treeMem.ring = tTopo->tecRing(detId);
323  treeMem.petal = tTopo->tecPetalInfo(detId)[1];
324  treeMem.outerInner = tTopo->tecPetalInfo(detId)[0];
325  treeMem.module = tTopo->tecModule(detId);
326  treeMem.isStereo = tTopo->tecStereo(detId);
327  treeMem.isDoubleSide = tTopo->tecIsDoubleSide(detId);
328  }
329 
330  //variables concerning the tracker geometry
331 
332  const Surface::PositionType &gPModule = tkgeom.idToDet(detId)->position();
333  treeMem.posPhi = gPModule.phi();
334  treeMem.posEta = gPModule.eta();
335  treeMem.posR = gPModule.perp();
336  treeMem.posX = gPModule.x();
337  treeMem.posY = gPModule.y();
338  treeMem.posZ = gPModule.z();
339 
340  const Surface& surface = tkgeom.idToDet(detId)->surface();
341 
342  //global Orientation of local coordinate system of dets/detUnits
343  LocalPoint lUDirection(1.,0.,0.), lVDirection(0.,1.,0.), lWDirection(0.,0.,1.);
344  GlobalPoint gUDirection = surface.toGlobal(lUDirection),
345  gVDirection = surface.toGlobal(lVDirection),
346  gWDirection = surface.toGlobal(lWDirection);
347  double dR(999.), dPhi(999.), dZ(999.);
349  dR = gWDirection.perp() - gPModule.perp();
350  dPhi = deltaPhi(gUDirection.phi(),gPModule.phi());
351  dZ = gVDirection.z() - gPModule.z();
352  if(dZ>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1;
353  }else if(treeMem.subDetId==PixelSubdetector::PixelEndcap){
354  dR = gUDirection.perp() - gPModule.perp();
355  dPhi = deltaPhi(gVDirection.phi(),gPModule.phi());
356  dZ = gWDirection.z() - gPModule.z();
357  if(dR>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1;
358  }else if(treeMem.subDetId==StripSubdetector::TID || treeMem.subDetId==StripSubdetector::TEC){
359  dR = gVDirection.perp() - gPModule.perp();
360  dPhi = deltaPhi(gUDirection.phi(),gPModule.phi());
361  dZ = gWDirection.z() - gPModule.z();
362  if(dR>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1;
363  }
364  if(dR>=0.)treeMem.rDirection = 1; else treeMem.rDirection = -1;
365  if(dPhi>=0.)treeMem.phiDirection = 1; else treeMem.phiDirection = -1;
366  if(dZ>=0.)treeMem.zDirection = 1; else treeMem.zDirection = -1;
367 
368 
369  // Assign histos from first step (TrackerOfflineValidation) to the module's entry in the TTree for retrieving mean, rms, median ...
370  const std::string histDir = associateModuleHistsWithTree(treeMem, it->second, substructureName);
371 
372 
373  //mean and RMS values (extracted from histograms Xprime on module level)
374  treeMem.entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
375  treeMem.meanX = it->second.ResXprimeHisto->GetMean();
376  treeMem.rmsX = it->second.ResXprimeHisto->GetRMS();
377  //treeMem.sigmaX = Fwhm(it->second.ResXprimeHisto)/2.355;
378  if (useFit_) {
379  //call fit function which returns mean and sigma from the fit
380  //for absolute residuals
381  std::pair<float,float> fitResult1 = this->fitResiduals(it->second.ResXprimeHisto);
382  treeMem.fitMeanX = fitResult1.first;
383  treeMem.fitSigmaX = fitResult1.second;
384  //for normalized residuals
385  std::pair<float,float> fitResult2 = this->fitResiduals(it->second.NormResXprimeHisto);
386  treeMem.fitMeanNormX = fitResult2.first;
387  treeMem.fitSigmaNormX = fitResult2.second;
388  }
389 
390  //get median for absolute residuals
391  treeMem.medianX = this->getMedian(it->second.ResXprimeHisto);
392 
393  int numberOfBins=it->second.ResXprimeHisto->GetNbinsX();
394  treeMem.numberOfUnderflows = it->second.ResXprimeHisto->GetBinContent(0);
395  treeMem.numberOfOverflows = it->second.ResXprimeHisto->GetBinContent(numberOfBins+1);
396  treeMem.numberOfOutliers = it->second.ResXprimeHisto->GetBinContent(0)+it->second.ResXprimeHisto->GetBinContent(numberOfBins+1);
397  //mean and RMS values (extracted from histograms(normalized Xprime on module level)
398  treeMem.meanNormX = it->second.NormResXprimeHisto->GetMean();
399  treeMem.rmsNormX = it->second.NormResXprimeHisto->GetRMS();
400 
401  double stats[20];
402  it->second.NormResXprimeHisto->GetStats(stats);
403  // GF treeMem.chi2PerDofX = stats[3]/(stats[0]-1);
404  if (stats[0]) treeMem.chi2PerDofX = stats[3]/stats[0];
405 
406  //treeMem.sigmaNormX = Fwhm(it->second.NormResXprimeHisto)/2.355;
407  treeMem.histNameX = it->second.ResXprimeHisto->GetName();
408  treeMem.histNameNormX = it->second.NormResXprimeHisto->GetName();
409 
410 
411  // fill tree variables in local coordinates if set in cfg of TrackerOfllineValidation
412  if(it->second.ResHisto && it->second.NormResHisto){ // if(lCoorHistOn_) {
413  treeMem.meanLocalX = it->second.ResHisto->GetMean();
414  treeMem.rmsLocalX = it->second.ResHisto->GetRMS();
415  treeMem.meanNormLocalX = it->second.NormResHisto->GetMean();
416  treeMem.rmsNormLocalX = it->second.NormResHisto->GetRMS();
417  treeMem.histNameLocalX = it->second.ResHisto->GetName();
418  treeMem.histNameNormLocalX = it->second.NormResHisto->GetName();
419  }
420 
421  // mean and RMS values in local y (extracted from histograms Yprime on module level)
422  // might exist in pixel only
423  if (it->second.ResYprimeHisto) { //(stripYResiduals_){
424  TH1 *h = it->second.ResYprimeHisto;
425  treeMem.meanY = h->GetMean();
426  treeMem.rmsY = h->GetRMS();
427 
428  if (useFit_) { // fit function which returns mean and sigma from the fit
429  std::pair<float,float> fitMeanSigma = this->fitResiduals(h);
430  treeMem.fitMeanY = fitMeanSigma.first;
431  treeMem.fitSigmaY = fitMeanSigma.second;
432  }
433 
434  //get median for absolute residuals
435  treeMem.medianY = this->getMedian(h);
436 
437  treeMem.histNameY = h->GetName();
438  }
439 
440  if (it->second.NormResYprimeHisto) {
441  TH1 *h = it->second.NormResYprimeHisto;
442  treeMem.meanNormY = h->GetMean();
443  treeMem.rmsNormY = h->GetRMS();
444  h->GetStats(stats); // stats buffer defined above
445  if (stats[0]) treeMem.chi2PerDofY = stats[3]/stats[0];
446 
447  if (useFit_) { // fit function which returns mean and sigma from the fit
448  std::pair<float,float> fitMeanSigma = this->fitResiduals(h);
449  treeMem.fitMeanNormY = fitMeanSigma.first;
450  treeMem.fitSigmaNormY = fitMeanSigma.second;
451  }
452  treeMem.histNameNormY = h->GetName();
453  }
454 
455  // Delete module level hists if set in cfg
456  const bool removeModuleLevelHists(parSet_.getParameter<bool>("removeModuleLevelHists"));
457  if(removeModuleLevelHists){
458  dbe_->setCurrentFolder("");
459  if(it->second.ResHisto) dbe_->removeElement(histDir + "/" + it->second.ResHisto->GetName());
460  if(it->second.NormResHisto) dbe_->removeElement(histDir + "/" + it->second.NormResHisto->GetName());
461  if(it->second.ResXprimeHisto) dbe_->removeElement(histDir + "/" + it->second.ResXprimeHisto->GetName());
462  if(it->second.NormResXprimeHisto)dbe_->removeElement(histDir + "/" + it->second.NormResXprimeHisto->GetName());
463  if(it->second.ResYprimeHisto) dbe_->removeElement(histDir + "/" + it->second.ResYprimeHisto->GetName());
464  if(it->second.NormResYprimeHisto)dbe_->removeElement(histDir + "/" + it->second.NormResYprimeHisto->GetName());
465  }
466 
467  tree.Fill();
468  }
469 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
T getParameter(std::string const &) const
bool tecIsDoubleSide(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
bool tibIsDoubleSide(const DetId &id) const
T perp() const
Definition: PV3DBase.h:72
unsigned int tibLayer(const DetId &id) const
unsigned int tidRing(const DetId &id) const
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
uint32_t tobStereo(const DetId &id) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
unsigned int pxbLadder(const DetId &id) const
T y() const
Definition: PV3DBase.h:63
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
std::vector< unsigned int > tibStringInfo(const DetId &id) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:41
unsigned int tidSide(const DetId &id) const
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
uint32_t tidStereo(const DetId &id) const
std::vector< unsigned int > tobRodInfo(const DetId &id) const
const std::string associateModuleHistsWithTree(const TkOffTreeVariables &treeMem, TrackerOfflineValidationSummary::ModuleHistos &moduleHists, std::map< std::string, std::string > &substructureName)
T z() const
Definition: PV3DBase.h:64
void removeElement(const std::string &name)
Definition: DQMStore.cc:3093
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::pair< float, float > fitResiduals(TH1 *hist) const
virtual const GeomDet * idToDet(DetId) const
std::string histNameNormLocalX
unsigned int tibModule(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
Definition: DetId.h:18
std::string histNameLocalX
bool tidIsDoubleSide(const DetId &id) const
unsigned int tobModule(const DetId &id) const
T eta() const
Definition: PV3DBase.h:76
void clear()
set to empty values
uint32_t tecStereo(const DetId &id) const
unsigned int pxfSide(const DetId &id) const
uint32_t tibStereo(const DetId &id) const
T x() const
Definition: PV3DBase.h:62
unsigned int tecWheel(const DetId &id) const
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
std::pair< float, float > TrackerOfflineValidationSummary::fitResiduals ( TH1 *  hist) const
private

Definition at line 601 of file TrackerOfflineValidationSummary.cc.

References alignCSCRings::e, timingPdfMaker::mean, and cms::Exception::what().

Referenced by fillTree().

602 {
603  std::pair<float,float> fitResult(9999., 9999.);
604  if (!hist || hist->GetEntries() < 20) return fitResult;
605 
606  float mean = hist->GetMean();
607  float sigma = hist->GetRMS();
608 
609  try { // for < CMSSW_2_2_0 since ROOT warnings from fit are converted to exceptions
610  // Remove the try/catch for more recent CMSSW!
611  // first fit: two RMS around mean
612  TF1 func("tmp", "gaus", mean - 2.*sigma, mean + 2.*sigma);
613  if (0 == hist->Fit(&func,"QNR")) { // N: do not blow up file by storing fit!
614  mean = func.GetParameter(1);
615  sigma = func.GetParameter(2);
616  // second fit: three sigma of first fit around mean of first fit
617  func.SetRange(mean - 3.*sigma, mean + 3.*sigma);
618  // I: integral gives more correct results if binning is too wide
619  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
620  if (0 == hist->Fit(&func, "Q0LR")) {
621  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
622  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
623  }
624  fitResult.first = func.GetParameter(1);
625  fitResult.second = func.GetParameter(2);
626  }
627  }
628  } catch (cms::Exception const & e) {
629  edm::LogWarning("Alignment") << "@SUB=TrackerOfflineValidation::fitResiduals"
630  << "Caught this exception during ROOT fit: "
631  << e.what();
632  }
633  return fitResult;
634 }
virtual char const * what() const
Definition: Exception.cc:141
void TrackerOfflineValidationSummary::getBinning ( const std::string &  binningPSetName,
int &  nBinsX,
double &  lowerBoundX,
double &  upperBoundX 
) const
private

Definition at line 746 of file TrackerOfflineValidationSummary.cc.

References edm::ParameterSet::getParameter(), and parSet_.

Referenced by bookHarvestingHists().

747 {
748  const edm::ParameterSet& binningPSet = parSet_.getParameter<edm::ParameterSet>(binningPSetName);
749  nBinsX = binningPSet.getParameter<int>("Nbinx");
750  lowerBoundX = binningPSet.getParameter<double>("xmin");
751  upperBoundX = binningPSet.getParameter<double>("xmax");
752 }
T getParameter(std::string const &) const
float TrackerOfflineValidationSummary::getMedian ( const TH1 *  hist) const
private

Definition at line 638 of file TrackerOfflineValidationSummary.cc.

References j, pileupCalc::nbins, x, and detailsBasic3DVector::y.

Referenced by fillTree().

639 {
640  float median = 999;
641  const int nbins = histo->GetNbinsX();
642 
643  //extract median from histogram
644  double *x = new double[nbins];
645  double *y = new double[nbins];
646  for (int j = 0; j < nbins; j++) {
647  x[j] = histo->GetBinCenter(j+1);
648  y[j] = histo->GetBinContent(j+1);
649  }
650  median = TMath::Median(nbins, x, y);
651 
652  delete[] x; x = 0;
653  delete [] y; y = 0;
654 
655  return median;
656 }
int j
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10

Member Data Documentation

DQMStore* TrackerOfflineValidationSummary::dbe_
private
const edm::EventSetup* TrackerOfflineValidationSummary::lastSetup_
private

Definition at line 141 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const std::string TrackerOfflineValidationSummary::moduleDirectory_
private
bool TrackerOfflineValidationSummary::moduleMapsInitialized
private

Definition at line 130 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze().

std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mPxbResiduals_
private

Definition at line 132 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mPxeResiduals_
private

Definition at line 133 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTecResiduals_
private

Definition at line 137 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTibResiduals_
private

Definition at line 134 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTidResiduals_
private

Definition at line 135 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTobResiduals_
private

Definition at line 136 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const edm::ParameterSet TrackerOfflineValidationSummary::parSet_
private
edm::ESHandle<TrackerGeometry> TrackerOfflineValidationSummary::tkGeom_
private

Definition at line 122 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const bool TrackerOfflineValidationSummary::useFit_
private

Definition at line 126 of file TrackerOfflineValidationSummary.cc.

Referenced by fillTree().

std::vector<HarvestingHierarchy> TrackerOfflineValidationSummary::vHarvestingHierarchy_
private