#include <Alignment/TrackerOfflineValidationSummary/src/TrackerOfflineValidationSummary.cc>
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 66 of file TrackerOfflineValidationSummary.cc.
TrackerOfflineValidationSummary::TrackerOfflineValidationSummary | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 155 of file TrackerOfflineValidationSummary.cc.
References dbe_, and cmsCodeRules::cppFunctionSkipper::operator.
: parSet_(iConfig), moduleDirectory_(parSet_.getParameter<std::string>("moduleDirectoryInOutput")), useFit_(parSet_.getParameter<bool>("useFit")), dbe_(0), moduleMapsInitialized(false) { //now do what ever initialization is needed dbe_ = edm::Service<DQMStore>().operator->(); }
TrackerOfflineValidationSummary::~TrackerOfflineValidationSummary | ( | ) |
Definition at line 164 of file TrackerOfflineValidationSummary.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void TrackerOfflineValidationSummary::analyze | ( | const edm::Event & | evt, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 179 of file TrackerOfflineValidationSummary.cc.
References DetId::det(), TrackerGeometry::detIds(), 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.
{ // Access of EventSetup is needed to get the list of silicon-modules and their IDs // Since they do not change, it is accessed only once if(moduleMapsInitialized)return; iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom_ ); const TrackerGeometry* bareTkGeomPtr = &(*tkGeom_); const TrackingGeometry::DetIdContainer& detIdContainer = bareTkGeomPtr->detIds(); std::vector<DetId>::const_iterator iDet; for(iDet = detIdContainer.begin(); iDet != detIdContainer.end(); ++iDet){ const DetId& detId = *iDet; const uint32_t rawId = detId.rawId(); const unsigned int subdetId = detId.subdetId(); if (subdetId == PixelSubdetector::PixelBarrel) mPxbResiduals_[rawId]; else if(subdetId == PixelSubdetector::PixelEndcap) mPxeResiduals_[rawId]; else if(subdetId == StripSubdetector::TIB) mTibResiduals_[rawId]; else if(subdetId == StripSubdetector::TID) mTidResiduals_[rawId]; else if(subdetId == StripSubdetector::TOB) mTobResiduals_[rawId]; else if(subdetId == StripSubdetector::TEC) mTecResiduals_[rawId]; else { throw cms::Exception("Geometry Error") << "[TrackerOfflineValidationSummary] Error, tried to get reference for non-tracker subdet " << subdetId << " from detector " << detId.det(); mPxbResiduals_[0]; } } moduleMapsInitialized = true; }
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().
{ TkOffTreeVariables *treeMemPtr = 0; std::map<std::string,std::string> *substructureName = 0; tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr); tree.SetBranchAddress("SubstructureName", &substructureName); // Loop over modules to select accumulation criteria for harvesting plots for(unsigned int iSubdet = 1; iSubdet<7; ++iSubdet){ std::string hierarchyName(""); std::string componentName(""); std::vector<unsigned int> treeEntries; for(unsigned int iSide = 1; iSide<3; ++iSide){ // Set up only one collection for Barrels, not separated for side if(iSide==1 && (iSubdet==PixelSubdetector::PixelBarrel || iSubdet==StripSubdetector::TIB || iSubdet==StripSubdetector::TOB))continue; for(int iTree=0; iTree<tree.GetEntries(); ++iTree){ tree.GetEntry(iTree); // Do not use glued Dets if(treeMemPtr->isDoubleSide)continue; if(treeMemPtr->subDetId == iSubdet){ if(iSide!=treeMemPtr->side && (iSubdet==PixelSubdetector::PixelEndcap || iSubdet==StripSubdetector::TID || iSubdet==StripSubdetector::TEC))continue; treeEntries.push_back(iTree); if(hierarchyName.length() == 0){ hierarchyName = (*substructureName)["subdet"]; componentName = (*substructureName)["component"]; } } } HarvestingHierarchy harvestingHierarchy(hierarchyName,componentName,treeEntries); vHarvestingHierarchy_.push_back(harvestingHierarchy); hierarchyName = ""; componentName = ""; treeEntries.clear(); } } // Here could be a further separation of the HarvestingHierarchy. // E.g. separate the existing ones by layer and add them to the vector without deleting any element from the vector. // The existing hists will stay and the new ones are added // Now, book the corresponding histos this->bookHarvestingHists(); }
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, TkOffTreeVariables::ring, relativeConstraints::ring, TkOffTreeVariables::rod, TkOffTreeVariables::side, TkOffTreeVariables::subDetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.
Referenced by fillTree().
{ std::stringstream histDir, sSubdetName; std::string componentName; if(moduleDirectory_.length() != 0)histDir<<moduleDirectory_<<"/"; std::string wheelOrLayer("_layer_"); if(treeMem.subDetId == PixelSubdetector::PixelBarrel){ unsigned int half(treeMem.half), layer(treeMem.layer), ladder(0); if(layer==1){ if(half==2)ladder = treeMem.rod -5; else if(treeMem.rod>15)ladder = treeMem.rod -10; else ladder = treeMem.rod; }else if(layer==2){ if(half==2)ladder = treeMem.rod -8; else if(treeMem.rod>24)ladder = treeMem.rod -16; else ladder = treeMem.rod; }else if(layer==3){ if(half==2)ladder = treeMem.rod -11; else if(treeMem.rod>33)ladder = treeMem.rod -22; else ladder = treeMem.rod; } componentName = "Pixel"; sSubdetName<<"TPBBarrel_1"; histDir<<componentName<<"/"<<sSubdetName.str()<<"/TPBHalfBarrel_"<<treeMem.half<<"/TPBLayer_"<<treeMem.layer<<"/TPBLadder_"<<ladder; }else if(treeMem.subDetId == PixelSubdetector::PixelEndcap){ unsigned int side(treeMem.side), half(treeMem.half), blade(0); if(side==1)side=3; if(half==2)blade = treeMem.blade -6; else if(treeMem.blade>18)blade = treeMem.blade -12; else blade = treeMem.blade; componentName = "Pixel"; sSubdetName<<"TPEEndcap_"<<side; histDir<<componentName<<"/"<<sSubdetName.str()<<"/TPEHalfCylinder_"<<treeMem.half<<"/TPEHalfDisk_"<<treeMem.layer<<"/TPEBlade_"<<blade<<"/TPEPanel_"<<treeMem.panel; wheelOrLayer = "_wheel_"; }else if(treeMem.subDetId == StripSubdetector::TIB){ unsigned int half(treeMem.half), layer(treeMem.layer), surface(treeMem.outerInner), string(0); if(half==2){ if(layer==1){ if(surface==1)string = treeMem.rod -13; else if(surface==2)string = treeMem.rod -15; } if(layer==2){ if(surface==1)string = treeMem.rod -17; else if(surface==2)string = treeMem.rod -19; } if(layer==3){ if(surface==1)string = treeMem.rod -22; else if(surface==2)string = treeMem.rod -23; } if(layer==4){ if(surface==1)string = treeMem.rod -26; else if(surface==2)string = treeMem.rod -28; } } else string = treeMem.rod; std::stringstream detString; if(treeMem.layer<3 && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module; else detString<<""; componentName = "Strip"; sSubdetName<<"TIBBarrel_1"; histDir<<componentName<<"/"<<sSubdetName.str()<<"/TIBHalfBarrel_"<<treeMem.side<<"/TIBLayer_"<<treeMem.layer<<"/TIBHalfShell_"<<treeMem.half<<"/TIBSurface_"<<treeMem.outerInner<<"/TIBString_"<<string<<detString.str(); }else if(treeMem.subDetId == StripSubdetector::TID){ unsigned int side(treeMem.side), outerInner(0); if(side==1)side=3; if(treeMem.outerInner==1)outerInner=2; else if(treeMem.outerInner==2)outerInner=1; std::stringstream detString; if(treeMem.ring<3 && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module; else detString<<""; componentName = "Strip"; sSubdetName<<"TIDEndcap_"<<side; histDir<<componentName<<"/"<<sSubdetName.str()<<"/TIDDisk_"<<treeMem.layer<<"/TIDRing_"<<treeMem.ring<<"/TIDSide_"<<outerInner<<detString.str(); wheelOrLayer = "_wheel_"; }else if(treeMem.subDetId == StripSubdetector::TOB){ std::stringstream detString; if(treeMem.layer<3 && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module; else detString<<""; componentName = "Strip"; sSubdetName<<"TOBBarrel_4"; histDir<<componentName<<"/"<<sSubdetName.str()<<"/TOBHalfBarrel_"<<treeMem.side<<"/TOBLayer_"<<treeMem.layer<<"/TOBRod_"<<treeMem.rod<<detString.str(); }else if(treeMem.subDetId == StripSubdetector::TEC) { unsigned int side(0), outerInner(0), ring(0); if(treeMem.side==1)side=6; else if(treeMem.side==2)side=5; if(treeMem.outerInner==1)outerInner = 2; else if(treeMem.outerInner==2)outerInner=1; if(treeMem.layer>3 && treeMem.layer<7)ring = treeMem.ring -1; else if(treeMem.layer==7 || treeMem.layer==8)ring = treeMem.ring -2; else if(treeMem.layer==9)ring = treeMem.ring -3; else ring = treeMem.ring; std::stringstream detString; if((treeMem.ring<3 || treeMem.ring==5) && !treeMem.isDoubleSide)detString<<"/Det_"<<treeMem.module; else detString<<""; componentName = "Strip"; sSubdetName<<"TECEndcap_"<<side; histDir<<componentName<<"/"<<sSubdetName.str()<<"/TECDisk_"<<treeMem.layer<<"/TECSide_"<<outerInner<<"/TECPetal_"<<treeMem.petal<<"/TECRing_"<<ring<<detString.str(); wheelOrLayer = "_wheel_"; } substructureName["component"] = componentName; substructureName["subdet"] = sSubdetName.str(); std::stringstream histName; histName<<"residuals_subdet_"<<treeMem.subDetId<<wheelOrLayer<<treeMem.layer<<"_module_"<<treeMem.moduleId; std::string fullPath; fullPath = histDir.str()+"/h_xprime_"+histName.str(); if(dbe_->get(fullPath)) moduleHists.ResXprimeHisto = dbe_->get(fullPath)->getTH1(); else{edm::LogError("TrackerOfflineValidationSummary")<<"Problem with names in input file produced in TrackerOfflineValidation ...\n" <<"This histogram should exist in every configuration, " <<"but no histogram with name "<<fullPath<<" is found!"; return ""; } fullPath = histDir.str()+"/h_normxprime"+histName.str(); if(dbe_->get(fullPath)) moduleHists.NormResXprimeHisto = dbe_->get(fullPath)->getTH1(); fullPath = histDir.str()+"/h_yprime_"+histName.str(); if(dbe_->get(fullPath)) moduleHists.ResYprimeHisto = dbe_->get(fullPath)->getTH1(); fullPath = histDir.str()+"/h_normyprime"+histName.str(); if(dbe_->get(fullPath)) moduleHists.NormResYprimeHisto = dbe_->get(fullPath)->getTH1(); fullPath = histDir.str()+"/h_"+histName.str(); if(dbe_->get(fullPath)) moduleHists.ResHisto = dbe_->get(fullPath)->getTH1(); fullPath = histDir.str()+"/h_norm"+histName.str(); if(dbe_->get(fullPath)) moduleHists.NormResHisto = dbe_->get(fullPath)->getTH1(); return histDir.str(); }
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().
{ edm::LogInfo("TrackerOfflineValidationSummary")<<"Harvesting histograms will be booked for "<<vHarvestingHierarchy_.size()<<" different hierarchy selections"; for(std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin(); iHier != vHarvestingHierarchy_.end(); ++iHier){ std::stringstream dmrXprimeHistoName, dmrYprimeHistoName, dmrXprimeHistoTitle, dmrYprimeHistoTitle; dmrXprimeHistoName << "h_DmrXprime_" << iHier->hierarchyName; dmrYprimeHistoName << "h_DmrYprime_" << iHier->hierarchyName; dmrXprimeHistoTitle<< "DMR for " << iHier->hierarchyName <<";<#DeltaX> [cm];# modules"; dmrYprimeHistoTitle<< "DMR for " << iHier->hierarchyName <<";<#DeltaY> [cm];# modules"; std::string directoryString(moduleDirectory_); if(directoryString.length()!=0)directoryString += "/"; directoryString += iHier->componentName; dbe_->setCurrentFolder(directoryString); int nBinsX(0); double xMin(0.), xMax(0.); if(iHier->componentName == "Pixel"){ this->getBinning("TH1DmrXprimePixelModules",nBinsX,xMin,xMax); iHier->harvestingHistos.DmrXprime = dbe_->book1D(dmrXprimeHistoName.str(),dmrXprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1(); this->getBinning("TH1DmrYprimePixelModules",nBinsX,xMin,xMax); iHier->harvestingHistos.DmrYprime = dbe_->book1D(dmrYprimeHistoName.str(),dmrYprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1(); } else if(iHier->componentName == "Strip"){ this->getBinning("TH1DmrXprimeStripModules",nBinsX,xMin,xMax); iHier->harvestingHistos.DmrXprime = dbe_->book1D(dmrXprimeHistoName.str(),dmrXprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1(); if(!parSet_.getParameter<bool>("stripYDmrs"))continue; this->getBinning("TH1DmrYprimeStripModules",nBinsX,xMin,xMax); iHier->harvestingHistos.DmrYprime = dbe_->book1D(dmrYprimeHistoName.str(),dmrYprimeHistoTitle.str(),nBinsX,xMin,xMax)->getTH1(); } } }
void TrackerOfflineValidationSummary::collateHarvestingHists | ( | TTree & | tree | ) | [private] |
Definition at line 654 of file TrackerOfflineValidationSummary.cc.
References applyHarvestingHierarchy(), and fillHarvestingHists().
Referenced by endJob().
{ this->applyHarvestingHierarchy(tree); this->fillHarvestingHists(tree); }
void TrackerOfflineValidationSummary::endJob | ( | void | ) | [private, virtual] |
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.
{ AlignableTracker aliTracker(&(*tkGeom_)); AlignableObjectId aliobjid; TTree* tree = new TTree("TkOffVal","TkOffVal"); TkOffTreeVariables *treeMemPtr = new TkOffTreeVariables; // We create branches for all members of 'TkOffTreeVariables' (even if not needed). // This works because we have a dictionary for 'TkOffTreeVariables' // (see src/classes_def.xml and src/classes.h): tree->Branch("TkOffTreeVariables", &treeMemPtr); // address of pointer! // second branch needed for assigning names and titles to harvesting histograms consistent to others std::map<std::string,std::string> *substructureName = new std::map<std::string,std::string>; tree->Branch("SubstructureName", &substructureName, 32000, 00); // SplitLevel must be set to zero this->fillTree(*tree, mPxbResiduals_, *treeMemPtr, *tkGeom_, *substructureName); this->fillTree(*tree, mPxeResiduals_, *treeMemPtr, *tkGeom_, *substructureName); this->fillTree(*tree, mTibResiduals_, *treeMemPtr, *tkGeom_, *substructureName); this->fillTree(*tree, mTidResiduals_, *treeMemPtr, *tkGeom_, *substructureName); this->fillTree(*tree, mTobResiduals_, *treeMemPtr, *tkGeom_, *substructureName); this->fillTree(*tree, mTecResiduals_, *treeMemPtr, *tkGeom_, *substructureName); //dbe_->showDirStructure(); //dbe_->save("dqmOut.root"); // Method for filling histograms which show summarized values (mean, rms, median ...) // of the module-based histograms from TrackerOfflineValidation this->collateHarvestingHists(*tree); delete tree; tree = 0; delete treeMemPtr; treeMemPtr = 0; delete substructureName; substructureName = 0; }
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().
{ TkOffTreeVariables *treeMemPtr = 0; std::map<std::string,std::string> *substructureName = 0; tree.SetBranchAddress("TkOffTreeVariables", &treeMemPtr); tree.SetBranchAddress("SubstructureName", &substructureName); const unsigned int minEntriesPerModule(parSet_.getParameter<unsigned int>("minEntriesPerModuleForDmr")); edm::LogInfo("TrackerOfflineValidationSummary")<<"Median of a module is added to DMR plots if it contains at least "<<minEntriesPerModule<<" hits"; for(std::vector<HarvestingHierarchy>::iterator iHier = vHarvestingHierarchy_.begin(); iHier != vHarvestingHierarchy_.end(); ++iHier){ for(std::vector<unsigned int>::const_iterator iTreeEntries = iHier->treeEntries.begin(); iTreeEntries != iHier->treeEntries.end(); ++iTreeEntries){ tree.GetEntry(*iTreeEntries); if(treeMemPtr->entries < minEntriesPerModule)continue; iHier->harvestingHistos.DmrXprime->Fill(treeMemPtr->medianX); if(iHier->harvestingHistos.DmrYprime)iHier->harvestingHistos.DmrYprime->Fill(treeMemPtr->medianY); } } }
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(), TkOffTreeVariables::blade, PXFDetId::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(), TIBDetId::isDoubleSide(), TOBDetId::isDoubleSide(), TkOffTreeVariables::isDoubleSide, TECDetId::isDoubleSide(), TIDDetId::isDoubleSide(), TkOffTreeVariables::isStereo, PXBDetId::ladder(), TIBDetId::layer(), TOBDetId::layer(), TkOffTreeVariables::layer, PXBDetId::layer(), TkOffTreeVariables::meanLocalX, TkOffTreeVariables::meanNormLocalX, TkOffTreeVariables::meanNormX, TkOffTreeVariables::meanNormY, TkOffTreeVariables::meanX, TkOffTreeVariables::meanY, TkOffTreeVariables::medianX, TkOffTreeVariables::medianY, PXFDetId::module(), TOBDetId::module(), TIDDetId::module(), PXBDetId::module(), TECDetId::module(), TkOffTreeVariables::module, TIBDetId::module(), TkOffTreeVariables::moduleId, TkOffTreeVariables::numberOfOutliers, TkOffTreeVariables::numberOfOverflows, TkOffTreeVariables::numberOfUnderflows, TkOffTreeVariables::outerInner, TkOffTreeVariables::panel, PXFDetId::panel(), parSet_, PV3DBase< T, PVType, FrameType >::perp(), TkOffTreeVariables::petal, TECDetId::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(), TkOffTreeVariables::ring, TIDDetId::ring(), TECDetId::ring(), TkOffTreeVariables::rmsLocalX, TkOffTreeVariables::rmsNormLocalX, TkOffTreeVariables::rmsNormX, TkOffTreeVariables::rmsNormY, TkOffTreeVariables::rmsX, TkOffTreeVariables::rmsY, TOBDetId::rod(), TkOffTreeVariables::rod, TkOffTreeVariables::rOrZDirection, DQMStore::setCurrentFolder(), PXFDetId::side(), TkOffTreeVariables::side, TIDDetId::side(), TECDetId::side(), SiStripDetId::stereo(), TIBDetId::string(), TkOffTreeVariables::subDetId, DetId::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().
{ for(std::map<int, TrackerOfflineValidationSummary::ModuleHistos>::iterator it = moduleHist.begin(), itEnd= moduleHist.end(); it != itEnd;++it ) { treeMem.clear(); // make empty/default //variables concerning the tracker components/hierarchy levels const DetId detId = it->first; treeMem.moduleId = detId; treeMem.subDetId = detId.subdetId(); if(treeMem.subDetId == PixelSubdetector::PixelBarrel){ PXBDetId pxbId(detId); unsigned int whichHalfBarrel(1), rawId(detId.rawId()); //DetId does not know about halfBarrels is PXB ... if( (rawId>=302056964 && rawId<302059300) || (rawId>=302123268 && rawId<302127140) || (rawId>=302189572 && rawId<302194980) )whichHalfBarrel=2; treeMem.layer = pxbId.layer(); treeMem.half = whichHalfBarrel; treeMem.rod = pxbId.ladder(); // ... so, ladder is not per halfBarrel-Layer, but per barrel-layer! Needs complicated calculation in associateModuleHistsWithTree() treeMem.module = pxbId.module(); } else if(treeMem.subDetId == PixelSubdetector::PixelEndcap){ PXFDetId pxfId(detId); unsigned int whichHalfCylinder(1), rawId(detId.rawId()); //DetId does not kmow about halfCylinders in PXF if( (rawId>=352394500 && rawId<352406032) || (rawId>=352460036 && rawId<352471568) || (rawId>=344005892 && rawId<344017424) || (rawId>=344071428 && rawId<344082960) )whichHalfCylinder=2; treeMem.layer = pxfId.disk(); treeMem.side = pxfId.side(); treeMem.half = whichHalfCylinder; treeMem.blade = pxfId.blade(); treeMem.panel = pxfId.panel(); treeMem.module = pxfId.module(); } else if(treeMem.subDetId == StripSubdetector::TIB){ TIBDetId tibId(detId); unsigned int whichHalfShell(1), rawId(detId.rawId()); //DetId does not kmow about halfShells in TIB if ( (rawId>=369120484 && rawId<369120688) || (rawId>=369121540 && rawId<369121776) || (rawId>=369136932 && rawId<369137200) || (rawId>=369137988 && rawId<369138288) || (rawId>=369153396 && rawId<369153744) || (rawId>=369154436 && rawId<369154800) || (rawId>=369169844 && rawId<369170256) || (rawId>=369170900 && rawId<369171344) || (rawId>=369124580 && rawId<369124784) || (rawId>=369125636 && rawId<369125872) || (rawId>=369141028 && rawId<369141296) || (rawId>=369142084 && rawId<369142384) || (rawId>=369157492 && rawId<369157840) || (rawId>=369158532 && rawId<369158896) || (rawId>=369173940 && rawId<369174352) || (rawId>=369174996 && rawId<369175440) ) whichHalfShell=2; treeMem.layer = tibId.layer(); treeMem.side = tibId.string()[0]; treeMem.half = whichHalfShell; treeMem.rod = tibId.string()[2]; treeMem.outerInner = tibId.string()[1]; treeMem.module = tibId.module(); treeMem.isStereo = tibId.stereo(); treeMem.isDoubleSide = tibId.isDoubleSide(); } else if(treeMem.subDetId == StripSubdetector::TID){ TIDDetId tidId(detId); treeMem.layer = tidId.wheel(); treeMem.side = tidId.side(); treeMem.ring = tidId.ring(); treeMem.outerInner = tidId.module()[0]; treeMem.module = tidId.module()[1]; treeMem.isStereo = tidId.stereo(); treeMem.isDoubleSide = tidId.isDoubleSide(); } else if(treeMem.subDetId == StripSubdetector::TOB){ TOBDetId tobId(detId); treeMem.layer = tobId.layer(); treeMem.side = tobId.rod()[0]; treeMem.rod = tobId.rod()[1]; treeMem.module = tobId.module(); treeMem.isStereo = tobId.stereo(); treeMem.isDoubleSide = tobId.isDoubleSide(); } else if(treeMem.subDetId == StripSubdetector::TEC) { TECDetId tecId(detId); treeMem.layer = tecId.wheel(); treeMem.side = tecId.side(); treeMem.ring = tecId.ring(); treeMem.petal = tecId.petal()[1]; treeMem.outerInner = tecId.petal()[0]; treeMem.module = tecId.module(); treeMem.isStereo = tecId.stereo(); treeMem.isDoubleSide = tecId.isDoubleSide(); } //variables concerning the tracker geometry const Surface::PositionType &gPModule = tkgeom.idToDet(detId)->position(); treeMem.posPhi = gPModule.phi(); treeMem.posEta = gPModule.eta(); treeMem.posR = gPModule.perp(); treeMem.posX = gPModule.x(); treeMem.posY = gPModule.y(); treeMem.posZ = gPModule.z(); const Surface& surface = tkgeom.idToDet(detId)->surface(); //global Orientation of local coordinate system of dets/detUnits LocalPoint lUDirection(1.,0.,0.), lVDirection(0.,1.,0.), lWDirection(0.,0.,1.); GlobalPoint gUDirection = surface.toGlobal(lUDirection), gVDirection = surface.toGlobal(lVDirection), gWDirection = surface.toGlobal(lWDirection); double dR(999.), dPhi(999.), dZ(999.); if(treeMem.subDetId==PixelSubdetector::PixelBarrel || treeMem.subDetId==StripSubdetector::TIB || treeMem.subDetId==StripSubdetector::TOB){ dR = gWDirection.perp() - gPModule.perp(); dPhi = deltaPhi(gUDirection.phi(),gPModule.phi()); dZ = gVDirection.z() - gPModule.z(); if(dZ>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1; }else if(treeMem.subDetId==PixelSubdetector::PixelEndcap){ dR = gUDirection.perp() - gPModule.perp(); dPhi = deltaPhi(gVDirection.phi(),gPModule.phi()); dZ = gWDirection.z() - gPModule.z(); if(dR>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1; }else if(treeMem.subDetId==StripSubdetector::TID || treeMem.subDetId==StripSubdetector::TEC){ dR = gVDirection.perp() - gPModule.perp(); dPhi = deltaPhi(gUDirection.phi(),gPModule.phi()); dZ = gWDirection.z() - gPModule.z(); if(dR>=0.)treeMem.rOrZDirection = 1; else treeMem.rOrZDirection = -1; } if(dR>=0.)treeMem.rDirection = 1; else treeMem.rDirection = -1; if(dPhi>=0.)treeMem.phiDirection = 1; else treeMem.phiDirection = -1; if(dZ>=0.)treeMem.zDirection = 1; else treeMem.zDirection = -1; // Assign histos from first step (TrackerOfflineValidation) to the module's entry in the TTree for retrieving mean, rms, median ... const std::string histDir = associateModuleHistsWithTree(treeMem, it->second, substructureName); //mean and RMS values (extracted from histograms Xprime on module level) treeMem.entries = static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries()); treeMem.meanX = it->second.ResXprimeHisto->GetMean(); treeMem.rmsX = it->second.ResXprimeHisto->GetRMS(); //treeMem.sigmaX = Fwhm(it->second.ResXprimeHisto)/2.355; if (useFit_) { //call fit function which returns mean and sigma from the fit //for absolute residuals std::pair<float,float> fitResult1 = this->fitResiduals(it->second.ResXprimeHisto); treeMem.fitMeanX = fitResult1.first; treeMem.fitSigmaX = fitResult1.second; //for normalized residuals std::pair<float,float> fitResult2 = this->fitResiduals(it->second.NormResXprimeHisto); treeMem.fitMeanNormX = fitResult2.first; treeMem.fitSigmaNormX = fitResult2.second; } //get median for absolute residuals treeMem.medianX = this->getMedian(it->second.ResXprimeHisto); int numberOfBins=it->second.ResXprimeHisto->GetNbinsX(); treeMem.numberOfUnderflows = it->second.ResXprimeHisto->GetBinContent(0); treeMem.numberOfOverflows = it->second.ResXprimeHisto->GetBinContent(numberOfBins+1); treeMem.numberOfOutliers = it->second.ResXprimeHisto->GetBinContent(0)+it->second.ResXprimeHisto->GetBinContent(numberOfBins+1); //mean and RMS values (extracted from histograms(normalized Xprime on module level) treeMem.meanNormX = it->second.NormResXprimeHisto->GetMean(); treeMem.rmsNormX = it->second.NormResXprimeHisto->GetRMS(); double stats[20]; it->second.NormResXprimeHisto->GetStats(stats); // GF treeMem.chi2PerDofX = stats[3]/(stats[0]-1); if (stats[0]) treeMem.chi2PerDofX = stats[3]/stats[0]; //treeMem.sigmaNormX = Fwhm(it->second.NormResXprimeHisto)/2.355; treeMem.histNameX = it->second.ResXprimeHisto->GetName(); treeMem.histNameNormX = it->second.NormResXprimeHisto->GetName(); // fill tree variables in local coordinates if set in cfg of TrackerOfllineValidation if(it->second.ResHisto && it->second.NormResHisto){ // if(lCoorHistOn_) { treeMem.meanLocalX = it->second.ResHisto->GetMean(); treeMem.rmsLocalX = it->second.ResHisto->GetRMS(); treeMem.meanNormLocalX = it->second.NormResHisto->GetMean(); treeMem.rmsNormLocalX = it->second.NormResHisto->GetRMS(); treeMem.histNameLocalX = it->second.ResHisto->GetName(); treeMem.histNameNormLocalX = it->second.NormResHisto->GetName(); } // mean and RMS values in local y (extracted from histograms Yprime on module level) // might exist in pixel only if (it->second.ResYprimeHisto) { //(stripYResiduals_){ TH1 *h = it->second.ResYprimeHisto; treeMem.meanY = h->GetMean(); treeMem.rmsY = h->GetRMS(); if (useFit_) { // fit function which returns mean and sigma from the fit std::pair<float,float> fitMeanSigma = this->fitResiduals(h); treeMem.fitMeanY = fitMeanSigma.first; treeMem.fitSigmaY = fitMeanSigma.second; } //get median for absolute residuals treeMem.medianY = this->getMedian(h); treeMem.histNameY = h->GetName(); } if (it->second.NormResYprimeHisto) { TH1 *h = it->second.NormResYprimeHisto; treeMem.meanNormY = h->GetMean(); treeMem.rmsNormY = h->GetRMS(); h->GetStats(stats); // stats buffer defined above if (stats[0]) treeMem.chi2PerDofY = stats[3]/stats[0]; if (useFit_) { // fit function which returns mean and sigma from the fit std::pair<float,float> fitMeanSigma = this->fitResiduals(h); treeMem.fitMeanNormY = fitMeanSigma.first; treeMem.fitSigmaNormY = fitMeanSigma.second; } treeMem.histNameNormY = h->GetName(); } // Delete module level hists if set in cfg const bool removeModuleLevelHists(parSet_.getParameter<bool>("removeModuleLevelHists")); if(removeModuleLevelHists){ dbe_->setCurrentFolder(""); if(it->second.ResHisto) dbe_->removeElement(histDir + "/" + it->second.ResHisto->GetName()); if(it->second.NormResHisto) dbe_->removeElement(histDir + "/" + it->second.NormResHisto->GetName()); if(it->second.ResXprimeHisto) dbe_->removeElement(histDir + "/" + it->second.ResXprimeHisto->GetName()); if(it->second.NormResXprimeHisto)dbe_->removeElement(histDir + "/" + it->second.NormResXprimeHisto->GetName()); if(it->second.ResYprimeHisto) dbe_->removeElement(histDir + "/" + it->second.ResYprimeHisto->GetName()); if(it->second.NormResYprimeHisto)dbe_->removeElement(histDir + "/" + it->second.NormResYprimeHisto->GetName()); } tree.Fill(); } }
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().
{ std::pair<float,float> fitResult(9999., 9999.); if (!hist || hist->GetEntries() < 20) return fitResult; float mean = hist->GetMean(); float sigma = hist->GetRMS(); try { // for < CMSSW_2_2_0 since ROOT warnings from fit are converted to exceptions // Remove the try/catch for more recent CMSSW! // first fit: two RMS around mean TF1 func("tmp", "gaus", mean - 2.*sigma, mean + 2.*sigma); if (0 == hist->Fit(&func,"QNR")) { // N: do not blow up file by storing fit! mean = func.GetParameter(1); sigma = func.GetParameter(2); // second fit: three sigma of first fit around mean of first fit func.SetRange(mean - 3.*sigma, mean + 3.*sigma); // I: integral gives more correct results if binning is too wide // L: Likelihood can treat empty bins correctly (if hist not weighted...) if (0 == hist->Fit(&func, "Q0LR")) { if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn: hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw); } fitResult.first = func.GetParameter(1); fitResult.second = func.GetParameter(2); } } } catch (cms::Exception const & e) { edm::LogWarning("Alignment") << "@SUB=TrackerOfflineValidation::fitResiduals" << "Caught this exception during ROOT fit: " << e.what(); } return fitResult; }
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().
{ const edm::ParameterSet& binningPSet = parSet_.getParameter<edm::ParameterSet>(binningPSetName); nBinsX = binningPSet.getParameter<int>("Nbinx"); lowerBoundX = binningPSet.getParameter<double>("xmin"); upperBoundX = binningPSet.getParameter<double>("xmax"); }
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().
{ float median = 999; const int nbins = histo->GetNbinsX(); //extract median from histogram double *x = new double[nbins]; double *y = new double[nbins]; for (int j = 0; j < nbins; j++) { x[j] = histo->GetBinCenter(j+1); y[j] = histo->GetBinContent(j+1); } median = TMath::Median(nbins, x, y); delete[] x; x = 0; delete [] y; y = 0; return median; }
DQMStore* TrackerOfflineValidationSummary::dbe_ [private] |
Definition at line 130 of file TrackerOfflineValidationSummary.cc.
Referenced by associateModuleHistsWithTree(), bookHarvestingHists(), fillTree(), and TrackerOfflineValidationSummary().
const std::string TrackerOfflineValidationSummary::moduleDirectory_ [private] |
Definition at line 127 of file TrackerOfflineValidationSummary.cc.
Referenced by associateModuleHistsWithTree(), and bookHarvestingHists().
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.
std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mPxeResiduals_ [private] |
Definition at line 135 of file TrackerOfflineValidationSummary.cc.
std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTecResiduals_ [private] |
Definition at line 139 of file TrackerOfflineValidationSummary.cc.
std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTibResiduals_ [private] |
Definition at line 136 of file TrackerOfflineValidationSummary.cc.
std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTidResiduals_ [private] |
Definition at line 137 of file TrackerOfflineValidationSummary.cc.
std::map<int,TrackerOfflineValidationSummary::ModuleHistos> TrackerOfflineValidationSummary::mTobResiduals_ [private] |
Definition at line 138 of file TrackerOfflineValidationSummary.cc.
const edm::ParameterSet TrackerOfflineValidationSummary::parSet_ [private] |
Definition at line 123 of file TrackerOfflineValidationSummary.cc.
Referenced by bookHarvestingHists(), fillHarvestingHists(), fillTree(), and getBinning().
Definition at line 124 of file TrackerOfflineValidationSummary.cc.
const bool TrackerOfflineValidationSummary::useFit_ [private] |
Definition at line 128 of file TrackerOfflineValidationSummary.cc.
Referenced by fillTree().
std::vector<HarvestingHierarchy> TrackerOfflineValidationSummary::vHarvestingHierarchy_ [private] |
Definition at line 141 of file TrackerOfflineValidationSummary.cc.
Referenced by applyHarvestingHierarchy(), bookHarvestingHists(), and fillHarvestingHists().