Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make surface deformation plots much faster #11022

Merged
merged 10 commits into from
Sep 18, 2015
253 changes: 189 additions & 64 deletions Alignment/OfflineValidation/macros/PlotAlignmentValidation.C

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class PlotAlignmentValidation {
void setOutputDir( std::string dir );
void setTreeBaseDir( std::string dir = "TrackerOfflineValidationStandalone");

THStack* addHists(const char *selection, const TString &residType = "xPrime", TLegend **myLegend = 0, bool printModuleIds = false);//add hists fulfilling 'selection' on TTree; residType: xPrime,yPrime,xPrimeNorm,yPrimeNorm,x,y,xNorm; if (printModuleIds): cout DetIds
THStack* addHists(const TString& selection, const TString &residType = "xPrime", TLegend **myLegend = 0, bool printModuleIds = false);//add hists fulfilling 'selection' on TTree; residType: xPrime,yPrime,xPrimeNorm,yPrimeNorm,x,y,xNorm; if (printModuleIds): cout DetIds

// These are helpers for DMR plotting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void CosmicSplitterValidation::analyze(const edm::Event& iEvent, const edm::Even
if(type==int(StripSubdetector::TIB)){++nhitinTIB2;}
if(type==int(StripSubdetector::TOB)){++nhitinTOB2;}
if(type==int(StripSubdetector::TID)){++nhitinTID2;}
//\\if(type==int(StripSubdetector::TEC)){++nhitinTEC2;}
if(type==int(StripSubdetector::TEC)){++nhitinTEC2;}
if(type==int( kBPIX)){++nhitinBPIX2;}
if(type==int( kFPIX)){++nhitinFPIX2;}

Expand Down Expand Up @@ -486,7 +486,7 @@ void CosmicSplitterValidation::analyze(const edm::Event& iEvent, const edm::Even
if(type==int(StripSubdetector::TIB)){++nhitinTIBorg;}
if(type==int(StripSubdetector::TOB)){++nhitinTOBorg;}
if(type==int(StripSubdetector::TID)){++nhitinTIDorg;}
//\\if(type==int(StripSubdetector::TEC)){++nhitinTECorg;}
if(type==int(StripSubdetector::TEC)){++nhitinTECorg;}
if(type==int( kBPIX)){++nhitinBPIXorg;}
if(type==int( kFPIX)){++nhitinFPIXorg;}

Expand Down
65 changes: 63 additions & 2 deletions Alignment/OfflineValidation/plugins/TrackerOfflineValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ class TrackerOfflineValidation : public edm::EDAnalyzer {
struct SummaryContainer{
SummaryContainer() : sumXResiduals_(), summaryXResiduals_(),
sumNormXResiduals_(), summaryNormXResiduals_(),
sumYResiduals_(), summaryYResiduals_() ,
sumNormYResiduals_(), summaryNormYResiduals_() {}
sumYResiduals_(), summaryYResiduals_(),
sumNormYResiduals_(), summaryNormYResiduals_(),
sumResXvsXProfile_(), sumResXvsYProfile_(),
sumResYvsXProfile_(), sumResYvsYProfile_() {}

TH1* sumXResiduals_;
TH1* summaryXResiduals_;
Expand All @@ -128,6 +130,11 @@ class TrackerOfflineValidation : public edm::EDAnalyzer {
TH1* summaryYResiduals_;
TH1* sumNormYResiduals_;
TH1* summaryNormYResiduals_;

TH1* sumResXvsXProfile_;
TH1* sumResXvsYProfile_;
TH1* sumResYvsXProfile_;
TH1* sumResYvsYProfile_;
};


Expand Down Expand Up @@ -1281,6 +1288,15 @@ TrackerOfflineValidation::collateSummaryHists( DirectoryWrapper& tfd, const Alig
vLevelProfiles[iComp].sumNormXResiduals_->Add(vProfiles[n].sumNormXResiduals_);
if (hY) hY->Add(vProfiles[n].sumYResiduals_); // only if existing
if (hNormY) hNormY->Add(vProfiles[n].sumNormYResiduals_); // dito (pxl, stripYResiduals_)

TH1 *pXX = vLevelProfiles[iComp].sumResXvsXProfile_;
TH1 *pXY = vLevelProfiles[iComp].sumResXvsYProfile_;
TH1 *pYX = vLevelProfiles[iComp].sumResYvsXProfile_;
TH1 *pYY = vLevelProfiles[iComp].sumResYvsYProfile_;
if (pXX) pXX->Add(vProfiles[n].sumResXvsXProfile_);
if (pXY) pXY->Add(vProfiles[n].sumResXvsYProfile_);
if (pYX) pYX->Add(vProfiles[n].sumResYvsXProfile_);
if (pYY) pYY->Add(vProfiles[n].sumResYvsYProfile_);
}
if(dqmMode_)continue; // No fits in dqmMode
//add fit values to stat box
Expand Down Expand Up @@ -1386,6 +1402,21 @@ TrackerOfflineValidation::bookSummaryHists(DirectoryWrapper& tfd, const Alignabl
sumContainer.sumNormXResiduals_ = tfd.make<TH1F>(Form("h_NormXprime_%s_%d",aliTypeName,i),
sumTitle + xTitHists.NormResXprimeHisto->GetXaxis()->GetTitle(),
nbins, xmin, xmax);

if ( moduleLevelProfiles_ ) {
this->getBinning(aliDetId.subdetId(), XResidualProfile, nbins, xmin, xmax);
sumContainer.sumResXvsXProfile_ = tfd.make<TProfile>(Form("p_resXX_%s_%d",aliTypeName,i),
sumTitle + xTitHists.ResXvsXProfile->GetXaxis()->GetTitle()
+ ";" + xTitHists.ResXvsXProfile->GetYaxis()->GetTitle(),
nbins, xmin, xmax);
sumContainer.sumResXvsXProfile_->Sumw2();
sumContainer.sumResXvsYProfile_ = tfd.make<TProfile>(Form("p_resXY_%s_%d",aliTypeName,i),
sumTitle + xTitHists.ResXvsYProfile->GetXaxis()->GetTitle()
+ ";" + xTitHists.ResXvsYProfile->GetYaxis()->GetTitle(),
nbins, xmin, xmax);
sumContainer.sumResXvsYProfile_->Sumw2();
}

if (bookResidY) {
this->getBinning(aliDetId.subdetId(), YprimeResidual, nbins, xmin, xmax);
sumContainer.sumYResiduals_ = tfd.make<TH1F>(Form("h_Yprime_%s_%d",aliTypeName,i),
Expand All @@ -1396,6 +1427,20 @@ TrackerOfflineValidation::bookSummaryHists(DirectoryWrapper& tfd, const Alignabl
sumContainer.sumNormYResiduals_ = tfd.make<TH1F>(Form("h_NormYprime_%s_%d",aliTypeName,i),
sumTitle + xTitHists.NormResYprimeHisto->GetXaxis()->GetTitle(),
nbins, xmin, xmax);

if ( moduleLevelProfiles_ ) {
this->getBinning(aliDetId.subdetId(), YResidualProfile, nbins, xmin, xmax);
sumContainer.sumResYvsXProfile_ = tfd.make<TProfile>(Form("p_resYX_%s_%d",aliTypeName,i),
sumTitle + xTitHists.ResYvsXProfile->GetXaxis()->GetTitle()
+ ";" + xTitHists.ResYvsXProfile->GetYaxis()->GetTitle(),
nbins, xmin, xmax);
sumContainer.sumResYvsXProfile_->Sumw2();
sumContainer.sumResYvsYProfile_ = tfd.make<TProfile>(Form("p_resYY_%s_%d",aliTypeName,i),
sumTitle + xTitHists.ResYvsYProfile->GetXaxis()->GetTitle()
+ ";" + xTitHists.ResYvsYProfile->GetYaxis()->GetTitle(),
nbins, xmin, xmax);
sumContainer.sumResYvsYProfile_->Sumw2();
}
}

// If we are at the lowest level, we already sum up and fill the summary.
Expand All @@ -1408,9 +1453,17 @@ TrackerOfflineValidation::bookSummaryHists(DirectoryWrapper& tfd, const Alignabl
this->summarizeBinInContainer(k+1, detid.subdetId() ,sumContainer, histStruct );
sumContainer.sumXResiduals_->Add(histStruct.ResXprimeHisto);
sumContainer.sumNormXResiduals_->Add(histStruct.NormResXprimeHisto);
if ( moduleLevelProfiles_ ) {
sumContainer.sumResXvsXProfile_->Add(histStruct.ResXvsXProfile);
sumContainer.sumResXvsYProfile_->Add(histStruct.ResXvsYProfile);
}
if( this->isPixel(detid.subdetId()) || stripYResiduals_ ) {
sumContainer.sumYResiduals_->Add(histStruct.ResYprimeHisto);
sumContainer.sumNormYResiduals_->Add(histStruct.NormResYprimeHisto);
if ( moduleLevelProfiles_ ) {
sumContainer.sumResYvsXProfile_->Add(histStruct.ResYvsXProfile);
sumContainer.sumResYvsYProfile_->Add(histStruct.ResYvsYProfile);
}
}
}
} else if( subtype == align::AlignableDet && subcompSize > 1) { // fixed: was aliSize before
Expand All @@ -1422,9 +1475,17 @@ TrackerOfflineValidation::bookSummaryHists(DirectoryWrapper& tfd, const Alignabl
this->summarizeBinInContainer(2*k+j+1, detid.subdetId() ,sumContainer, histStruct );
sumContainer.sumXResiduals_->Add( histStruct.ResXprimeHisto);
sumContainer.sumNormXResiduals_->Add( histStruct.NormResXprimeHisto);
if ( moduleLevelProfiles_ ) {
sumContainer.sumResXvsXProfile_->Add(histStruct.ResXvsXProfile);
sumContainer.sumResXvsYProfile_->Add(histStruct.ResXvsYProfile);
}
if( this->isPixel(detid.subdetId()) || stripYResiduals_ ) {
sumContainer.sumYResiduals_->Add( histStruct.ResYprimeHisto);
sumContainer.sumNormYResiduals_->Add( histStruct.NormResYprimeHisto);
if ( moduleLevelProfiles_ ) {
sumContainer.sumResYvsXProfile_->Add(histStruct.ResYvsXProfile);
sumContainer.sumResYvsYProfile_->Add(histStruct.ResYvsYProfile);
}
}
}
}
Expand Down
Loading