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

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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &)
 
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 ()
 
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)
 
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 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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

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

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

Definition at line 66 of file TrackerOfflineValidationSummary.cc.

Constructor & Destructor Documentation

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

Definition at line 155 of file TrackerOfflineValidationSummary.cc.

References dbe_, and cmsCodeRules.cppFunctionSkipper::operator.

155  :
156  parSet_(iConfig), moduleDirectory_(parSet_.getParameter<std::string>("moduleDirectoryInOutput")),
157  useFit_(parSet_.getParameter<bool>("useFit")), dbe_(0), moduleMapsInitialized(false)
158 {
159  //now do what ever initialization is needed
161 }
T getParameter(std::string const &) const
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 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 179 of file TrackerOfflineValidationSummary.cc.

References DetId::det(), TrackerGeometry::detIds(), edm::hlt::Exception, edm::EventSetup::get(), 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  // Access of EventSetup is needed to get the list of silicon-modules and their IDs
182  // Since they do not change, it is accessed only once
183  if(moduleMapsInitialized)return;
184  iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom_ );
185  const TrackerGeometry* bareTkGeomPtr = &(*tkGeom_);
186  const TrackingGeometry::DetIdContainer& detIdContainer = bareTkGeomPtr->detIds();
187  std::vector<DetId>::const_iterator iDet;
188  for(iDet = detIdContainer.begin(); iDet != detIdContainer.end(); ++iDet){
189  const DetId& detId = *iDet;
190  const uint32_t rawId = detId.rawId();
191  const unsigned int subdetId = detId.subdetId();
192  if (subdetId == PixelSubdetector::PixelBarrel) mPxbResiduals_[rawId];
193  else if(subdetId == PixelSubdetector::PixelEndcap) mPxeResiduals_[rawId];
194  else if(subdetId == StripSubdetector::TIB) mTibResiduals_[rawId];
195  else if(subdetId == StripSubdetector::TID) mTidResiduals_[rawId];
196  else if(subdetId == StripSubdetector::TOB) mTobResiduals_[rawId];
197  else if(subdetId == StripSubdetector::TEC) mTecResiduals_[rawId];
198  else {
199  throw cms::Exception("Geometry Error")
200  << "[TrackerOfflineValidationSummary] Error, tried to get reference for non-tracker subdet " << subdetId
201  << " from detector " << detId.det();
202  mPxbResiduals_[0];
203  }
204  }
205  moduleMapsInitialized = true;
206 }
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mPxbResiduals_
edm::ESHandle< TrackerGeometry > tkGeom_
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
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:39
std::map< int, TrackerOfflineValidationSummary::ModuleHistos > mTidResiduals_
Definition: DetId.h:20
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:37
std::vector< DetId > DetIdContainer
void TrackerOfflineValidationSummary::applyHarvestingHierarchy ( TTree &  treeMem)
private

Definition at line 662 of file TrackerOfflineValidationSummary.cc.

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

Referenced by collateHarvestingHists().

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

References TkOffTreeVariables::blade, dbe_, 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, TkOffTreeVariables::subDetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by fillTree().

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

Definition at line 705 of file TrackerOfflineValidationSummary.cc.

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

Referenced by applyHarvestingHierarchy().

706 {
707  edm::LogInfo("TrackerOfflineValidationSummary")<<"Harvesting histograms will be booked for "<<vHarvestingHierarchy_.size()<<" different hierarchy selections";
708  for(std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin(); iHier != vHarvestingHierarchy_.end(); ++iHier){
709 
710  std::stringstream dmrXprimeHistoName, dmrYprimeHistoName, dmrXprimeHistoTitle, dmrYprimeHistoTitle;
711  dmrXprimeHistoName << "h_DmrXprime_" << iHier->hierarchyName;
712  dmrYprimeHistoName << "h_DmrYprime_" << iHier->hierarchyName;
713  dmrXprimeHistoTitle<< "DMR for " << iHier->hierarchyName <<";<#DeltaX> [cm];# modules";
714  dmrYprimeHistoTitle<< "DMR for " << iHier->hierarchyName <<";<#DeltaY> [cm];# modules";
715 
716  std::string directoryString(moduleDirectory_);
717  if(directoryString.length()!=0)directoryString += "/";
718  directoryString += iHier->componentName;
719  dbe_->setCurrentFolder(directoryString);
720 
721  int nBinsX(0); double xMin(0.), xMax(0.);
722  if(iHier->componentName == "Pixel"){
723  this->getBinning("TH1DmrXprimePixelModules",nBinsX,xMin,xMax);
724  iHier->harvestingHistos.DmrXprime = dbe_->book1D(dmrXprimeHistoName.str(),dmrXprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
725  this->getBinning("TH1DmrYprimePixelModules",nBinsX,xMin,xMax);
726  iHier->harvestingHistos.DmrYprime = dbe_->book1D(dmrYprimeHistoName.str(),dmrYprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
727  }
728  else if(iHier->componentName == "Strip"){
729  this->getBinning("TH1DmrXprimeStripModules",nBinsX,xMin,xMax);
730  iHier->harvestingHistos.DmrXprime = dbe_->book1D(dmrXprimeHistoName.str(),dmrXprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
731  if(!parSet_.getParameter<bool>("stripYDmrs"))continue;
732  this->getBinning("TH1DmrYprimeStripModules",nBinsX,xMin,xMax);
733  iHier->harvestingHistos.DmrYprime = dbe_->book1D(dmrYprimeHistoName.str(),dmrYprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1();
734  }
735  }
736 }
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:514
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:232
void TrackerOfflineValidationSummary::collateHarvestingHists ( TTree &  tree)
private

Definition at line 654 of file TrackerOfflineValidationSummary.cc.

References applyHarvestingHierarchy(), and fillHarvestingHists().

Referenced by endJob().

void TrackerOfflineValidationSummary::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 211 of file TrackerOfflineValidationSummary.cc.

References collateHarvestingHists(), fillTree(), mPxbResiduals_, mPxeResiduals_, mTecResiduals_, mTibResiduals_, mTidResiduals_, mTobResiduals_, tkGeom_, and diffTreeTool::tree.

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

Definition at line 750 of file TrackerOfflineValidationSummary.cc.

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

Referenced by collateHarvestingHists().

751 {
752  TkOffTreeVariables *treeMemPtr = 0;
753  std::map<std::string,std::string> *substructureName = 0;
754  tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr);
755  tree.SetBranchAddress("SubstructureName", &substructureName);
756 
757  const unsigned int minEntriesPerModule(parSet_.getParameter<unsigned int>("minEntriesPerModuleForDmr"));
758  edm::LogInfo("TrackerOfflineValidationSummary")<<"Median of a module is added to DMR plots if it contains at least "<<minEntriesPerModule<<" hits";
759 
760  for(std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin(); iHier != vHarvestingHierarchy_.end(); ++iHier){
761  for(std::vector<unsigned int>::const_iterator iTreeEntries = iHier->treeEntries.begin(); iTreeEntries != iHier->treeEntries.end(); ++iTreeEntries){
762  tree.GetEntry(*iTreeEntries);
763  if(treeMemPtr->entries < minEntriesPerModule)continue;
764  iHier->harvestingHistos.DmrXprime->Fill(treeMemPtr->medianX);
765  if(iHier->harvestingHistos.DmrYprime)iHier->harvestingHistos.DmrYprime->Fill(treeMemPtr->medianY);
766  }
767  }
768 }
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 
)
private

Definition at line 249 of file TrackerOfflineValidationSummary.cc.

References associateModuleHistsWithTree(), PXFDetId::blade(), TkOffTreeVariables::blade, TkOffTreeVariables::chi2PerDofX, TkOffTreeVariables::chi2PerDofY, TkOffTreeVariables::clear(), dbe_, Geom::deltaPhi(), PXFDetId::disk(), dPhi(), 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(), TOBDetId::isDoubleSide(), TIBDetId::isDoubleSide(), TIDDetId::isDoubleSide(), TECDetId::isDoubleSide(), TkOffTreeVariables::isDoubleSide, TkOffTreeVariables::isStereo, PXBDetId::ladder(), PXBDetId::layer(), TOBDetId::layer(), TIBDetId::layer(), TkOffTreeVariables::layer, TkOffTreeVariables::meanLocalX, TkOffTreeVariables::meanNormLocalX, TkOffTreeVariables::meanNormX, TkOffTreeVariables::meanNormY, TkOffTreeVariables::meanX, TkOffTreeVariables::meanY, TkOffTreeVariables::medianX, TkOffTreeVariables::medianY, PXBDetId::module(), PXFDetId::module(), TOBDetId::module(), TIBDetId::module(), TIDDetId::module(), TECDetId::module(), TkOffTreeVariables::module, TkOffTreeVariables::moduleId, TkOffTreeVariables::numberOfOutliers, TkOffTreeVariables::numberOfOverflows, TkOffTreeVariables::numberOfUnderflows, TkOffTreeVariables::outerInner, PXFDetId::panel(), TkOffTreeVariables::panel, parSet_, PV3DBase< T, PVType, FrameType >::perp(), TECDetId::petal(), 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, DetId::rawId(), TkOffTreeVariables::rDirection, DQMStore::removeElement(), TIDDetId::ring(), TECDetId::ring(), TkOffTreeVariables::ring, TkOffTreeVariables::rmsLocalX, TkOffTreeVariables::rmsNormLocalX, TkOffTreeVariables::rmsNormX, TkOffTreeVariables::rmsNormY, TkOffTreeVariables::rmsX, TkOffTreeVariables::rmsY, TOBDetId::rod(), TkOffTreeVariables::rod, TkOffTreeVariables::rOrZDirection, DQMStore::setCurrentFolder(), PXFDetId::side(), TIDDetId::side(), TECDetId::side(), TkOffTreeVariables::side, SiStripDetId::stereo(), TIBDetId::string(), DetId::subdetId(), TkOffTreeVariables::subDetId, GeomDet::surface(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), useFit_, TIDDetId::wheel(), TECDetId::wheel(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and TkOffTreeVariables::zDirection.

Referenced by endJob().

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

Definition at line 595 of file TrackerOfflineValidationSummary.cc.

References plotscripts::mean(), and cms::Exception::what().

Referenced by fillTree().

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

Definition at line 740 of file TrackerOfflineValidationSummary.cc.

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

Referenced by bookHarvestingHists().

741 {
742  const edm::ParameterSet& binningPSet = parSet_.getParameter<edm::ParameterSet>(binningPSetName);
743  nBinsX = binningPSet.getParameter<int>("Nbinx");
744  lowerBoundX = binningPSet.getParameter<double>("xmin");
745  upperBoundX = binningPSet.getParameter<double>("xmax");
746 }
T getParameter(std::string const &) const
float TrackerOfflineValidationSummary::getMedian ( const TH1 *  hist) const
private

Definition at line 632 of file TrackerOfflineValidationSummary.cc.

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

Referenced by fillTree().

633 {
634  float median = 999;
635  const int nbins = histo->GetNbinsX();
636 
637  //extract median from histogram
638  double *x = new double[nbins];
639  double *y = new double[nbins];
640  for (int j = 0; j < nbins; j++) {
641  x[j] = histo->GetBinCenter(j+1);
642  y[j] = histo->GetBinContent(j+1);
643  }
644  median = TMath::Median(nbins, x, y);
645 
646  delete[] x; x = 0;
647  delete [] y; y = 0;
648 
649  return median;
650 }
tuple histo
Definition: trackerHits.py:12
int j
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10

Member Data Documentation

DQMStore* TrackerOfflineValidationSummary::dbe_
private
const std::string TrackerOfflineValidationSummary::moduleDirectory_
private
bool TrackerOfflineValidationSummary::moduleMapsInitialized
private

Definition at line 132 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze().

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

Definition at line 134 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 135 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 139 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 136 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 137 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 138 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

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

Definition at line 124 of file TrackerOfflineValidationSummary.cc.

Referenced by analyze(), and endJob().

const bool TrackerOfflineValidationSummary::useFit_
private

Definition at line 128 of file TrackerOfflineValidationSummary.cc.

Referenced by fillTree().

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