134 const std::string& basedir,
bool useDqmMode)
138 if (newDir.length()!=0){
146 if (newDir.length()==0)
tfd.reset(&(*upDir.
tfd));
161 if (newDir.length()==0){
170 if (newDir.length()!=0){
179 template <
typename T> TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX);
180 template <
typename T> TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double *xBins);
181 template <
typename T> TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX,
int nBinY,
double minBinY,
double maxBinY);
182 template <
typename T> TH1*
make(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX,
double minBinY,
double maxBinY);
184 std::auto_ptr<TFileDirectory>
tfd;
206 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles);
208 void fillTree(TTree&
tree,
const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
220 bool isPixel(uint32_t subDetId);
224 int nBinsX,
double lowX,
double highX);
227 int nBinsX,
double lowX,
double highX);
230 int nBinsX,
double lowX,
double highX,
double lowY,
double highY);
233 int& nBinsX,
double& lowerBoundX,
double& upperBoundX);
248 template <
class OBJECT_TYPE>
int GetIndex(
const std::vector<OBJECT_TYPE*>& vec,
const TString&
name);
292 template <
class OBJECT_TYPE>
296 for (
typename std::vector<OBJECT_TYPE*>::const_iterator iter = vec.begin(), iterEnd = vec.end();
297 iter != iterEnd; ++iter, ++
result) {
298 if (*iter && (*iter)->GetName() ==
name)
return result;
300 edm::LogError(
"Alignment") <<
"@SUB=TrackerOfflineValidation::GetIndex" <<
" could not find " <<
name;
305 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH1F>(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX){
306 if(dqmMode){theDbe->setCurrentFolder(directoryString);
return theDbe->book1D(
name,
title,nBinX,minBinX,maxBinX)->getTH1();}
307 else{
return tfd->make<TH1F>(
name,
title,nBinX,minBinX,maxBinX);}
310 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name,
const char*
title,
int nBinX,
double *xBins){
312 theDbe->setCurrentFolder(directoryString);
314 TProfile *tmpProfile=
new TProfile(
name,
title,nBinX,xBins);
315 tmpProfile->SetDirectory(0);
316 return theDbe->bookProfile(
name,tmpProfile)->getTH1();
318 else{
return tfd->make<TProfile>(
name,
title,nBinX,xBins);}
321 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX){
323 theDbe->setCurrentFolder(directoryString);
325 TProfile *tmpProfile=
new TProfile(
name,
title,nBinX,minBinX,maxBinX);
326 tmpProfile->SetDirectory(0);
327 return theDbe->bookProfile(
name,tmpProfile)->getTH1();
329 else{
return tfd->make<TProfile>(
name,
title,nBinX,minBinX,maxBinX);}
332 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TProfile>(
const char*
name ,
const char*
title,
int nbinX,
double minX ,
double maxX,
double minY,
double maxY){
334 theDbe->setCurrentFolder(directoryString);
343 template <> TH1* TrackerOfflineValidation::DirectoryWrapper::make<TH2F>(
const char*
name,
const char*
title,
int nBinX,
double minBinX,
double maxBinX,
int nBinY,
double minBinY,
double maxBinY){
344 if(dqmMode){theDbe->setCurrentFolder(directoryString);
return theDbe->book2D(
name,
title,nBinX,minBinX,maxBinX,nBinY,minBinY,maxBinY)->getTH1();}
345 else{
return tfd->make<TH2F>(
name,
title,nBinX,minBinX,maxBinX,nBinY,minBinY,maxBinY);}
353 : parSet_(iConfig), bareTkGeomPtr_(0), lCoorHistOn_(parSet_.getParameter<bool>(
"localCoorHistosOn")),
354 moduleLevelHistsTransient_(parSet_.getParameter<bool>(
"moduleLevelHistsTransient")),
355 moduleLevelProfiles_(parSet_.getParameter<bool>(
"moduleLevelProfiles")),
356 stripYResiduals_(parSet_.getParameter<bool>(
"stripYResiduals")),
357 useFwhm_(parSet_.getParameter<bool>(
"useFwhm")),
358 useFit_(parSet_.getParameter<bool>(
"useFit")),
359 useOverflowForRMS_(parSet_.getParameter<bool>(
"useOverflowForRMS")),
360 dqmMode_(parSet_.getParameter<bool>(
"useInDqmMode")),
361 moduleDirectory_(parSet_.getParameter<std::string>(
"moduleDirectoryInOutput"))
395 edm::LogInfo(
"TrackerOfflineValidation") <<
"There are " << newBareTkGeomPtr->
detIds().size()
396 <<
" dets in the Geometry record.\n"
397 <<
"Out of these "<<newBareTkGeomPtr->
detUnitIds().size()
401 std::string globDir(
"GlobalTrackVariables");
411 <<
"TrackerGeometry changed, but will not re-book hists!";
422 "Track #eta;#eta_{Track};Number of Tracks",
425 "Track #phi;#phi_{Track};Number of Tracks",
428 "Track # of valid hits;# of valid hits _{Track};Number of Tracks",
431 "Track # of lost hits;# of lost hits _{Track};Number of Tracks",
434 "Curvature #kappa;#kappa_{Track};Number of Tracks",
437 "Curvature |#kappa| Positive Tracks;|#kappa_{pos Track}|;Number of Tracks",
440 "Curvature |#kappa| Negative Tracks;|#kappa_{neg Track}|;Number of Tracks",
443 "Curvature |#kappa| Tracks Difference;|#kappa_{Track}|;# Pos Tracks - # Neg Tracks",
446 "#chi^{2};#chi^{2}_{Track};Number of Tracks",
449 "#chi^{2} probability;#chi^{2}prob_{Track};Number of Tracks",
452 "#chi^{2}/ndof;#chi^{2}/ndof;Number of Tracks",
455 "p_{T}^{track};p_{T}^{track} [GeV];Number of Tracks",
458 "#delta{p_{T}/p_{T}^{track}};#delta_{p_{T}/p_{T}^{track}};Number of Tracks",
462 "Transverse Impact Parameter vs. #phi;#phi_{Track};#LT d_{0} #GT [cm]",
465 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};#LT d_{z} #GT [cm]",
468 "Transverse Impact Parameter vs. #eta;#eta_{Track};#LT d_{0} #GT [cm]",
471 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};#LT d_{z} #GT [cm]",
474 "#chi^{2} vs. #phi;#phi_{Track};#LT #chi^{2} #GT",
477 "#chi^{2} probablility vs. #phi;#phi_{Track};#LT #chi^{2} probability#GT",
480 "#chi^{2}/ndof vs. #phi;#phi_{Track};#LT #chi^{2}/ndof #GT",
483 "#chi^{2} vs. #eta;#eta_{Track};#LT #chi^{2} #GT",
486 double xBins[19]={0.,0.15,0.5,1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.,7.,10.,15.,25.,40.,100.,200.};
488 "norm #chi^{2} vs. p_{T}_{Track}; p_{T}_{Track};#LT #chi^{2}/ndof #GT",
492 "#chi^{2}/ndof vs. p_{Track};p_{Track};#LT #chi^{2}/ndof #GT",
495 "#chi^{2} probability vs. #eta;#eta_{Track};#LT #chi^{2} probability #GT",
498 "#chi^{2}/ndof vs. #eta;#eta_{Track};#LT #chi^{2}/ndof #GT",
501 "#kappa vs. #phi;#phi_{Track};#kappa",
504 "#kappa vs. #eta;#eta_{Track};#kappa",
507 "#delta_{p_{T}}/p_{T}^{track};#phi^{track};#delta_{p_{T}}/p_{T}^{track}",
510 "#delta_{p_{T}}/p_{T}^{track};#eta^{track};#delta_{p_{T}}/p_{T}^{track}",
514 "Transverse Impact Parameter vs. #phi;#phi_{Track};d_{0} [cm]",
515 100, -3.15, 3.15, 100,-1.,1.) );
517 "Longitudinal Impact Parameter vs. #phi;#phi_{Track};d_{z} [cm]",
518 100, -3.15, 3.15, 100,-100.,100.));
520 "Transverse Impact Parameter vs. #eta;#eta_{Track};d_{0} [cm]",
521 100, -3.15, 3.15, 100,-1.,1.));
523 "Longitudinal Impact Parameter vs. #eta;#eta_{Track};d_{z} [cm]",
524 100, -3.15, 3.15, 100,-100.,100.));
526 "#chi^{2} vs. #phi;#phi_{Track};#chi^{2}",
527 100, -3.15, 3.15, 500, 0., 500.));
529 "#chi^{2} probability vs. #phi;#phi_{Track};#chi^{2} probability",
530 100, -3.15, 3.15, 100, 0., 1.));
532 "#chi^{2}/ndof vs. #phi;#phi_{Track};#chi^{2}/ndof",
533 100, -3.15, 3.15, 100, 0., 10.));
535 "#chi^{2} vs. #eta;#eta_{Track};#chi^{2}",
536 100, -3.15, 3.15, 500, 0., 500.));
538 "#chi^{2} probaility vs. #eta;#eta_{Track};#chi^{2} probability",
539 100, -3.15, 3.15, 100, 0., 1.));
541 "#chi^{2}/ndof vs. #eta;#eta_{Track};#chi^{2}/ndof",
542 100,-3.15,3.15, 100, 0., 10.));
544 "#kappa vs. #phi;#phi_{Track};#kappa",
545 100,-3.15,3.15, 100, .0,.05));
547 "#kappa vs. #eta;#eta_{Track};#kappa",
548 100,-3.15,3.15, 100, .0,.05));
550 "#kappa vs. #chi^{2}/ndof;#chi^{2}/ndof;#kappa",
551 100,0.,10, 100,-.03,.03));
555 "#momentum vs. #resX in pixB;#momentum;#resX",
556 15,0.,15., 200, -0.1,0.1));
558 "#momentum vs. #resX in pixE;#momentum;#resX",
559 15,0.,15., 200, -0.1,0.1));
561 "#momentum vs. #resX in TIB;#momentum;#resX",
562 15,0.,15., 200, -0.1,0.1));
564 "#momentum vs. #resX in TID;#momentum;#resX",
565 15,0.,15., 200, -0.1,0.1));
567 "#momentum vs. #resX in TOB;#momentum;#resX",
568 15,0.,15., 200, -0.1,0.1));
570 "#momentum vs. #resX in TEC;#momentum;#resX",
571 15,0.,15., 200, -0.1,0.1));
575 "#momentum vs. #resY in pixB;#momentum;#resY",
576 15,0.,15., 200, -0.1,0.1));
578 "#momentum vs. #resY in pixE;#momentum;#resY",
579 15,0.,15., 200, -0.1,0.1));
587 std::vector<Alignable*> alivec(ali.
components());
589 std::string structurename = aliobjid.
typeToName((alivec)[
i]->alignableObjectId());
590 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
591 std::stringstream dirname;
592 dirname << structurename;
594 if (structurename !=
"Strip" && structurename !=
"Pixel") dirname <<
"_" <<
i+1;
596 if (structurename.find(
"Endcap",0) != std::string::npos ) {
600 }
else if( !(this->
isDetOrDetUnit( (alivec)[i]->alignableObjectId()) )
601 || alivec[i]->components().
size() > 1) {
630 std::stringstream histoname, histotitle, normhistoname, normhistotitle,
631 yhistoname, yhistotitle,
632 xprimehistoname, xprimehistotitle, normxprimehistoname, normxprimehistotitle,
633 yprimehistoname, yprimehistotitle, normyprimehistoname, normyprimehistotitle,
634 localxname, localxtitle, localyname, localytitle,
635 resxvsxprofilename, resxvsxprofiletitle, resyvsxprofilename, resyvsxprofiletitle,
636 resxvsyprofilename, resxvsyprofiletitle, resyvsyprofilename, resyvsyprofiletitle;
638 std::string wheel_or_layer;
640 if( this->
isEndCap(static_cast<uint32_t>(subdetandlayer.first)) ) wheel_or_layer =
"_wheel_";
641 else if ( this->
isBarrel(static_cast<uint32_t>(subdetandlayer.first)) ) wheel_or_layer =
"_layer_";
642 else edm::LogWarning(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookHists"
643 <<
"Unknown subdetid: " << subdetandlayer.first;
645 histoname <<
"h_residuals_subdet_" << subdetandlayer.first
646 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
647 yhistoname <<
"h_y_residuals_subdet_" << subdetandlayer.first
648 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
649 xprimehistoname <<
"h_xprime_residuals_subdet_" << subdetandlayer.first
650 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
651 yprimehistoname <<
"h_yprime_residuals_subdet_" << subdetandlayer.first
652 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
653 normhistoname <<
"h_normresiduals_subdet_" << subdetandlayer.first
654 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
655 normxprimehistoname <<
"h_normxprimeresiduals_subdet_" << subdetandlayer.first
656 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
657 normyprimehistoname <<
"h_normyprimeresiduals_subdet_" << subdetandlayer.first
658 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
659 histotitle <<
"X Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit} [cm]";
660 yhistotitle <<
"Y Residual for module " <<
id.rawId() <<
";y_{tr} - y_{hit} [cm]";
661 normhistotitle <<
"Normalized Residual for module " <<
id.rawId() <<
";x_{tr} - x_{hit}/#sigma";
662 xprimehistotitle <<
"X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})' [cm]";
663 normxprimehistotitle <<
"Normalized X' Residual for module " <<
id.rawId() <<
";(x_{tr} - x_{hit})'/#sigma";
664 yprimehistotitle <<
"Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})' [cm]";
665 normyprimehistotitle <<
"Normalized Y' Residual for module " <<
id.rawId() <<
";(y_{tr} - y_{hit})'/#sigma";
668 localxname <<
"h_localx_subdet_" << subdetandlayer.first
669 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
670 localyname <<
"h_localy_subdet_" << subdetandlayer.first
671 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
672 localxtitle <<
"u local for module " <<
id.rawId() <<
"; u_{tr,r}";
673 localytitle <<
"v local for module " <<
id.rawId() <<
"; v_{tr,r}";
675 resxvsxprofilename <<
"p_residuals_x_vs_x_subdet_" << subdetandlayer.first
676 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
677 resyvsxprofilename <<
"p_residuals_y_vs_x_subdet_" << subdetandlayer.first
678 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
679 resxvsyprofilename <<
"p_residuals_x_vs_y_subdet_" << subdetandlayer.first
680 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
681 resyvsyprofilename <<
"p_residuals_y_vs_y_subdet_" << subdetandlayer.first
682 << wheel_or_layer << subdetandlayer.second <<
"_module_" <<
id.rawId();
683 resxvsxprofiletitle <<
"U Residual vs u for module " <<
id.rawId() <<
"; u_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
684 resyvsxprofiletitle <<
"V Residual vs u for module " <<
id.rawId() <<
"; u_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
685 resxvsyprofiletitle <<
"U Residual vs v for module " <<
id.rawId() <<
"; v_{tr,r} ;(u_{tr} - u_{hit})/tan#alpha [cm]";
686 resyvsyprofiletitle <<
"V Residual vs v for module " <<
id.rawId() <<
"; v_{tr,r} ;(v_{tr} - v_{hit})/tan#beta [cm]";
692 double xmin = 0., xmax = 0.;
693 double ymin = -0.1, ymax = 0.1;
697 if (
dqmMode_) moduleLevelHistsTransient =
false;
703 histoname.str().c_str(),histotitle.str().c_str(),
707 normhistoname.str().c_str(),normhistotitle.str().c_str(),
712 xprimehistoname.str().c_str(),xprimehistotitle.str().c_str(),
716 normxprimehistoname.str().c_str(),normxprimehistotitle.str().c_str(),
722 histStruct.
LocalX = this->
bookTH1F(moduleLevelHistsTransient, tfd,
723 localxname.str().c_str(),localxtitle.str().c_str(),
725 histStruct.
LocalY = this->
bookTH1F(moduleLevelHistsTransient, tfd,
726 localyname.str().c_str(),localytitle.str().c_str(),
729 resxvsxprofilename.str().c_str(),resxvsxprofiletitle.str().c_str(),
730 nbins, xmin, xmax, ymin, ymax);
732 resxvsyprofilename.str().c_str(),resxvsyprofiletitle.str().c_str(),
733 nbins, xmin, xmax, ymin, ymax);
739 yprimehistoname.str().c_str(),yprimehistotitle.str().c_str(),
744 yhistoname.str().c_str(), yhistotitle.str().c_str(),
749 normyprimehistoname.str().c_str(),normyprimehistotitle.str().c_str(),
756 resyvsxprofilename.str().c_str(),resyvsxprofiletitle.str().c_str(),
757 nbins, xmin, xmax, ymin, ymax);
759 resyvsyprofilename.str().c_str(),resyvsyprofiletitle.str().c_str(),
760 nbins, xmin, xmax, ymin, ymax);
768 int nBinsX,
double lowX,
double highX)
771 vDeleteObjects_.push_back(
new TH1F(histName, histTitle, nBinsX, lowX, highX));
775 return tfd.
make<TH1F>(histName, histTitle, nBinsX, lowX, highX);
779 int nBinsX,
double lowX,
double highX)
782 TProfile *
profile =
new TProfile(histName, histTitle, nBinsX, lowX, highX);
787 return (TProfile*)tfd.
make<TProfile>(histName, histTitle, nBinsX, lowX, highX);
792 int nBinsX,
double lowX,
double highX,
double lowY,
double highY)
795 TProfile *
profile =
new TProfile(histName, histTitle, nBinsX, lowX, highX, lowY, highY);
800 return (TProfile*)tfd.
make<TProfile>(histName, histTitle, nBinsX, lowX, highX, lowY, highY);
836 int& nBinsX,
double& lowerBoundX,
double& upperBoundX)
889 if(targetHist && sourceHist) {
890 targetHist->SetBinContent(bin, sourceHist->GetMean(1));
891 if(
useFwhm_) targetHist->SetBinError(bin,
Fwhm(sourceHist)/2.);
892 else targetHist->SetBinError(bin, sourceHist->GetRMS(1) );
946 <<
"[TrackerOfflineValidation] Error, tried to get reference for non-tracker subdet " << subdetid
947 <<
" from detector " << detid.
det();
962 std::vector<TrackerValidationVariables::AVTrackStruct> vTrackstruct;
965 for (std::vector<TrackerValidationVariables::AVTrackStruct>::const_iterator itT = vTrackstruct.begin();
966 itT != vTrackstruct.end();
975 vTrackHistos_[numOfValidHitsindex]->Fill(itT->numberOfValidHits);
977 vTrackHistos_[numOfLostHitsindex]->Fill(itT->numberOfLostHits);
994 if (itT->ptError != 0.) {
996 vTrackHistos_[ptResolutionindex]->Fill(itT->ptError/itT->pt);
1061 for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator itH = itT->hits.begin();
1062 itH != itT->hits.end();
1070 histStruct.
ResHisto->Fill(itH->resX);
1071 if(itH->resErrX != 0) histStruct.
NormResHisto->Fill(itH->resX/itH->resErrX);
1077 if (itH->resXprime != -999.) {
1108 float tgalpha =
tan(itH->localAlpha);
1109 if ( fabs(tgalpha)!=0 ){
1110 histStruct.
LocalX->Fill(itH->localXnorm, tgalpha*tgalpha);
1111 histStruct.
LocalY->Fill(itH->localYnorm, tgalpha*tgalpha);
1112 histStruct.
ResXvsXProfile->Fill(itH->localXnorm, itH->resX/tgalpha, tgalpha*tgalpha);
1113 histStruct.
ResXvsYProfile->Fill(itH->localYnorm, itH->resX/tgalpha, tgalpha*tgalpha);
1117 if(itH->resXprimeErr != 0 && itH->resXprimeErr != -999 ) {
1122 if (itH->resYprime != -999.) {
1138 float tgbeta =
tan(itH->localBeta);
1139 if ( fabs(tgbeta)!=0 ){
1140 histStruct.
ResYvsXProfile->Fill(itH->localXnorm, itH->resY/tgbeta, tgbeta*tgbeta);
1141 histStruct.
ResYvsYProfile->Fill(itH->localYnorm, itH->resY/tgbeta, tgbeta*tgbeta);
1145 if (itH->resYprimeErr != 0 && itH->resYprimeErr != -999. ) {
1175 std::vector<TrackerOfflineValidation::SummaryContainer> vTrackerprofiles;
1184 TTree *
tree = fs->
make<TTree>(
"TkOffVal",
"TkOffVal");
1190 tree->Branch(
"TkOffTreeVariables", &treeMemPtr);
1199 delete treeMemPtr; treeMemPtr = 0;
1206 std::vector<TrackerOfflineValidation::SummaryContainer>& vLevelProfiles)
1208 std::vector<Alignable*> alivec(ali.
components());
1209 if( this->
isDetOrDetUnit((alivec)[0]->alignableObjectId()) )
return;
1211 for(
int iComp=0, iCompEnd = ali.
components().size();iComp < iCompEnd; ++iComp) {
1212 std::vector< TrackerOfflineValidation::SummaryContainer > vProfiles;
1213 std::string structurename = aliobjid.
typeToName((alivec)[iComp]->alignableObjectId());
1215 LogDebug(
"TrackerOfflineValidation") <<
"StructureName = " << structurename;
1216 std::stringstream dirname;
1217 dirname << structurename;
1220 if (structurename !=
"Strip" && structurename !=
"Pixel") dirname <<
"_" << iComp+1;
1222 if( !(this->
isDetOrDetUnit( (alivec)[iComp]->alignableObjectId()) )
1223 || (alivec)[0]->components().
size() > 1 ) {
1227 TH1 *hY = vLevelProfiles[iComp].sumYResiduals_;
1228 TH1 *hNormY = vLevelProfiles[iComp].sumNormYResiduals_;
1229 for(uint
n = 0;
n < vProfiles.size(); ++
n) {
1231 vLevelProfiles[iComp].sumXResiduals_->Add(vProfiles[n].sumXResiduals_);
1232 vLevelProfiles[iComp].sumNormXResiduals_->Add(vProfiles[n].sumNormXResiduals_);
1233 if (hY) hY->Add(vProfiles[n].sumYResiduals_);
1234 if (hNormY) hNormY->Add(vProfiles[n].sumNormYResiduals_);
1238 this->
fitResiduals(vLevelProfiles[iComp].sumXResiduals_);
1239 this->
fitResiduals(vLevelProfiles[iComp].sumNormXResiduals_);
1255 const uint aliSize = ali.
components().size();
1258 const char *aliTypeName = aliobjid.
typeToName(alitype).c_str();
1259 const char *aliSubtypeName = aliobjid.
typeToName(subtype).c_str();
1260 const char *typeName = aliobjid.
typeToName(type).c_str();
1262 const DetId aliDetId = ali.
id();
1272 const uint subcompSize = ali.
components()[0]->components().size();
1274 const TString
title(Form(
"Summary for substructures in %s %d;%s;",aliTypeName,i,aliSubtypeName));
1276 sumContainer.summaryXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryX%s_%d",aliTypeName,i),
1277 title +
"#LT #Delta x' #GT",
1278 aliSize, 0.5, aliSize+0.5);
1279 sumContainer.summaryNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d",aliTypeName,i),
1280 title +
"#LT #Delta x'/#sigma #GT",
1281 aliSize,0.5,aliSize+0.5);
1284 sumContainer.summaryYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryY%s_%d",aliTypeName,i),
1285 title +
"#LT #Delta y' #GT",
1286 aliSize, 0.5, aliSize+0.5);
1287 sumContainer.summaryNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d",aliTypeName,i),
1288 title +
"#LT #Delta y'/#sigma #GT",
1289 aliSize,0.5,aliSize+0.5);
1293 if (subcompSize != 2) {
1296 <<
"Det with " << subcompSize <<
" components";
1299 const TString
title(Form(
"Summary for substructures in %s %d;%s;", aliTypeName, i,
1302 sumContainer.summaryXResiduals_
1303 = tfd.
make<TH1F>(Form(
"h_summaryX%s_%d", aliTypeName, i),
1304 title +
"#LT #Delta x' #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1305 sumContainer.summaryNormXResiduals_
1306 = tfd.
make<TH1F>(Form(
"h_summaryNormX%s_%d", aliTypeName, i),
1307 title +
"#LT #Delta x'/#sigma #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1310 sumContainer.summaryYResiduals_
1311 = tfd.
make<TH1F>(Form(
"h_summaryY%s_%d", aliTypeName, i),
1312 title +
"#LT #Delta y' #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1313 sumContainer.summaryNormYResiduals_
1314 = tfd.
make<TH1F>(Form(
"h_summaryNormY%s_%d", aliTypeName, i),
1315 title +
"#LT #Delta y'/#sigma #GT", (2*aliSize), 0.5, 2*aliSize+0.5);
1319 edm::LogError(
"TrackerOfflineValidation") <<
"@SUB=TrackerOfflineValidation::bookSummaryHists"
1320 <<
"No summary histogramm for hierarchy level "
1321 << aliTypeName <<
" in subdet " << aliDetId.
subdetId();
1328 double xmin = 0., xmax = 0.;
1329 const TString sumTitle(Form(
"Residual for %s %d in %s;", aliTypeName, i, typeName));
1333 sumContainer.sumXResiduals_ = tfd.
make<TH1F>(Form(
"h_Xprime_%s_%d", aliTypeName, i),
1338 sumContainer.sumNormXResiduals_ = tfd.
make<TH1F>(Form(
"h_NormXprime_%s_%d",aliTypeName,i),
1343 sumContainer.sumYResiduals_ = tfd.
make<TH1F>(Form(
"h_Yprime_%s_%d",aliTypeName,i),
1348 sumContainer.sumNormYResiduals_ = tfd.
make<TH1F>(Form(
"h_NormYprime_%s_%d",aliTypeName,i),
1357 for(uint
k = 0;
k < aliSize; ++
k) {
1370 for(uint
k = 0;
k < aliSize; ++
k) {
1371 for(uint
j = 0;
j < subcompSize; ++
j) {
1384 return sumContainer;
1391 float max = hist->GetMaximum();
1392 int left = -1, right = -1;
1393 for(
unsigned int i = 1, iEnd = hist->GetNbinsX();
i <= iEnd; ++
i) {
1394 if(hist->GetBinContent(
i) < max/2. && hist->GetBinContent(
i+1) > max/2. && left == -1) {
1395 if(max/2. - hist->GetBinContent(
i) < hist->GetBinContent(
i+1) - max/2.) {
1403 if(left != -1 && right == -1) {
1404 if(hist->GetBinContent(
i) > max/2. && hist->GetBinContent(
i+1) < max/2.) {
1405 if( hist->GetBinContent(
i) - max/2. < max/2. - hist->GetBinContent(
i+1)) {
1414 return hist->GetXaxis()->GetBinCenter(right) - hist->GetXaxis()->GetBinCenter(left);
1420 const std::map<int, TrackerOfflineValidation::ModuleHistos>& moduleHist_,
1424 for(std::map<int, TrackerOfflineValidation::ModuleHistos>::const_iterator it = moduleHist_.begin(),
1425 itEnd= moduleHist_.end(); it != itEnd;++it ) {
1429 DetId detId_ = it->first;
1436 unsigned int whichHalfBarrel(1), rawId(detId_.
rawId());
1437 if( (rawId>=302056964 && rawId<302059300) || (rawId>=302123268 && rawId<302127140) || (rawId>=302189572 && rawId<302194980) )whichHalfBarrel=2;
1439 treeMem.
half = whichHalfBarrel;
1444 unsigned int whichHalfCylinder(1), rawId(detId_.
rawId());
1445 if( (rawId>=352394500 && rawId<352406032) || (rawId>=352460036 && rawId<352471568) || (rawId>=344005892 && rawId<344017424) || (rawId>=344071428 && rawId<344082960) )whichHalfCylinder=2;
1448 treeMem.
half = whichHalfCylinder;
1454 unsigned int whichHalfShell(1), rawId(detId_.
rawId());
1455 if ( (rawId>=369120484 && rawId<369120688) || (rawId>=369121540 && rawId<369121776) || (rawId>=369136932 && rawId<369137200) || (rawId>=369137988 && rawId<369138288) ||
1456 (rawId>=369153396 && rawId<369153744) || (rawId>=369154436 && rawId<369154800) || (rawId>=369169844 && rawId<369170256) || (rawId>=369170900 && rawId<369171344) ||
1457 (rawId>=369124580 && rawId<369124784) || (rawId>=369125636 && rawId<369125872) || (rawId>=369141028 && rawId<369141296) || (rawId>=369142084 && rawId<369142384) ||
1458 (rawId>=369157492 && rawId<369157840) || (rawId>=369158532 && rawId<369158896) || (rawId>=369173940 && rawId<369174352) || (rawId>=369174996 && rawId<369175440) ) whichHalfShell=2;
1461 treeMem.
half = whichHalfShell;
1479 treeMem.
side = tobId.
rod()[0];
1480 treeMem.
rod = tobId.
rod()[1];
1501 treeMem.
posX = gPModule.
x();
1502 treeMem.
posY = gPModule.
y();
1503 treeMem.
posZ = gPModule.
z();
1508 LocalPoint lUDirection(1.,0.,0.), lVDirection(0.,1.,0.), lWDirection(0.,0.,1.);
1510 gVDirection = surface.
toGlobal(lVDirection),
1511 gWDirection = surface.
toGlobal(lWDirection);
1512 double dR(999.),
dPhi(999.), dZ(999.);
1514 dR = gWDirection.perp() - gPModule.
perp();
1516 dZ = gVDirection.z() - gPModule.
z();
1519 dR = gUDirection.
perp() - gPModule.
perp();
1521 dZ = gWDirection.z() - gPModule.
z();
1524 dR = gVDirection.perp() - gPModule.
perp();
1526 dZ = gWDirection.z() - gPModule.
z();
1534 treeMem.
entries =
static_cast<UInt_t>(it->second.ResXprimeHisto->GetEntries());
1535 treeMem.
meanX = it->second.ResXprimeHisto->GetMean();
1536 treeMem.
rmsX = it->second.ResXprimeHisto->GetRMS();
1542 std::pair<float,float> fitResult1 = this->
fitResiduals(it->second.ResXprimeHisto);
1543 treeMem.
fitMeanX = fitResult1.first;
1546 std::pair<float,float> fitResult2 = this->
fitResiduals(it->second.NormResXprimeHisto);
1554 int numberOfBins=it->second.ResXprimeHisto->GetNbinsX();
1556 treeMem.
numberOfOverflows = it->second.ResXprimeHisto->GetBinContent(numberOfBins+1);
1557 treeMem.
numberOfOutliers = it->second.ResXprimeHisto->GetBinContent(0)+it->second.ResXprimeHisto->GetBinContent(numberOfBins+1);
1560 treeMem.
meanNormX = it->second.NormResXprimeHisto->GetMean();
1561 treeMem.
rmsNormX = it->second.NormResXprimeHisto->GetRMS();
1564 it->second.NormResXprimeHisto->GetStats(stats);
1566 if (stats[0]) treeMem.
chi2PerDofX = stats[3]/stats[0];
1569 treeMem.
histNameX = it->second.ResXprimeHisto->GetName();
1570 treeMem.
histNameNormX = it->second.NormResXprimeHisto->GetName();
1574 treeMem.
meanLocalX = it->second.ResHisto->GetMean();
1575 treeMem.
rmsLocalX = it->second.ResHisto->GetRMS();
1581 if (it->second.ResYHisto) treeMem.
histNameLocalY = it->second.ResYHisto->GetName();
1586 if (it->second.ResYprimeHisto) {
1587 TH1 *
h = it->second.ResYprimeHisto;
1588 treeMem.
meanY = h->GetMean();
1589 treeMem.
rmsY = h->GetRMS();
1592 std::pair<float,float> fitMeanSigma = this->
fitResiduals(h);
1593 treeMem.
fitMeanY = fitMeanSigma.first;
1594 treeMem.
fitSigmaY = fitMeanSigma.second;
1602 if (it->second.NormResYprimeHisto) {
1603 TH1 *
h = it->second.NormResYprimeHisto;
1607 if (stats[0]) treeMem.
chi2PerDofY = stats[3]/stats[0];
1610 std::pair<float,float> fitMeanSigma = this->
fitResiduals(h);
1621 std::pair<float,float>
1624 std::pair<float,float> fitResult(9999., 9999.);
1625 if (!hist || hist->GetEntries() < 20)
return fitResult;
1627 float mean = hist->GetMean();
1628 float sigma = hist->GetRMS();
1633 TF1 func(
"tmp",
"gaus", mean - 2.*sigma, mean + 2.*sigma);
1634 if (0 == hist->Fit(&func,
"QNR")) {
1635 mean = func.GetParameter(1);
1636 sigma = func.GetParameter(2);
1638 func.SetRange(mean - 3.*sigma, mean + 3.*sigma);
1641 if (0 == hist->Fit(&func,
"Q0LR")) {
1642 if (hist->GetFunction(func.GetName())) {
1643 hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
1645 fitResult.first = func.GetParameter(1);
1646 fitResult.second = func.GetParameter(2);
1650 edm::LogWarning(
"Alignment") <<
"@SUB=TrackerOfflineValidation::fitResiduals"
1651 <<
"Caught this exception during ROOT fit: "
1662 int nbins = histo->GetNbinsX();
1665 double *
x =
new double[
nbins];
1666 double *
y =
new double[
nbins];
1668 x[
j] = histo->GetBinCenter(
j+1);
1669 y[
j] = histo->GetBinContent(
j+1);
1671 median = TMath::Median(nbins, x, y);
const TrackerGeometry * bareTkGeomPtr_
virtual char const * what() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
bool isDoubleSide() const
unsigned int panel() const
panel id
std::vector< TH1 * > vDeleteObjects_
void bookDirHists(DirectoryWrapper &tfd, const Alignable &ali, const AlignableObjectId &aliobjid)
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxeResiduals_
std::vector< TH1 * > vTrackHistos_
~TrackerOfflineValidation()
unsigned int layer() const
layer id
void bookHists(DirectoryWrapper &tfd, const Alignable &ali, align::StructureType type, int i, const AlignableObjectId &aliobjid)
TH1 * make(const char *name, const char *title, int nBinX, double minBinX, double maxBinX)
virtual uint32_t stereo() const
Float_t numberOfOverflows
bool isPixel(uint32_t subDetId)
void fillTree(TTree &tree, const std::map< int, TrackerOfflineValidation::ModuleHistos > &moduleHist_, TkOffTreeVariables &treeMem, const TrackerGeometry &tkgeom)
double deltaPhi(float phi1, float phi2)
bool isDoubleSide() const
std::vector< TH1 * > vTrack2DHistos_
TH1 * bookTH1F(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
std::map< int, TrackerOfflineValidation::ModuleHistos > mTecResiduals_
#define DEFINE_FWK_MODULE(type)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string directoryString
container to hold data to be written into TTree
const bool stripYResiduals_
const bool useOverflowForRMS_
Geom::Phi< T > phi() const
edm::ESHandle< TrackerGeometry > tkGeom_
int GetIndex(const std::vector< OBJECT_TYPE * > &vec, const TString &name)
unsigned int ladder() const
ladder id
const std::string & typeToName(align::StructureType type) const
Convert type to name.
float getMedian(const TH1 *hist) const
ModuleHistos & getHistStructFromMap(const DetId &detid)
const bool moduleLevelProfiles_
Float_t numberOfUnderflows
void setSummaryBin(int bin, TH1 *targetHist, TH1 *sourceHist)
virtual Alignables components() const =0
Return vector of all direct components.
std::map< int, TrackerOfflineValidation::ModuleHistos > mTibResiduals_
std::vector< unsigned int > string() const
string id
unsigned int module() const
det id
unsigned int layer() const
layer id
unsigned int side() const
positive or negative id
TProfile * ResXvsYProfile
TH1 * summaryNormYResiduals_
std::vector< unsigned int > rod() const
rod id
unsigned int blade() const
blade id
std::map< int, TrackerOfflineValidation::ModuleHistos > mTidResiduals_
uint32_t rawId() const
get the raw id
TProfile * ResYvsYProfile
virtual const DetIdContainer & detIds() const
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
std::vector< unsigned int > petal() const
petal id
const Surface::PositionType & position() const
The position (origin of the R.F.)
TH1 * summaryNormXResiduals_
std::string histNameNormX
double dPhi(double phi1, double phi2)
void getBinning(uint32_t subDetId, TrackerOfflineValidation::HistogrammType residualtype, int &nBinsX, double &lowerBoundX, double &upperBoundX)
const T & max(const T &a, const T &b)
unsigned int ring() const
ring id
Tan< T >::type tan(const T &t)
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
unsigned int module() const
det id
Allows conversion between type and name, and vice-versa.
virtual void checkBookHists(const edm::EventSetup &setup)
TProfile * bookTProfile(bool isTransient, DirectoryWrapper &tfd, const char *histName, const char *histTitle, int nBinsX, double lowX, double highX)
unsigned int module() const
det id
std::vector< unsigned int > module() const
det id
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::string histNameLocalY
virtual const GeomDet * idToDet(DetId) const
unsigned int disk() const
disk id
std::string histNameNormLocalX
bool isDetOrDetUnit(align::StructureType type)
std::map< int, TrackerOfflineValidation::ModuleHistos > mTobResiduals_
DirectoryWrapper(const std::string &newDir, const std::string &basedir, bool useDqmMode)
void collateSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, int i, const AlignableObjectId &aliobjid, std::vector< TrackerOfflineValidation::SummaryContainer > &vLevelProfiles)
const std::string moduleDirectory_
std::pair< float, float > fitResiduals(TH1 *hist) const
unsigned int module() const
detector id
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
unsigned int side() const
positive or negative id
std::string histNameLocalX
std::auto_ptr< TFileDirectory > tfd
T const * product() const
void summarizeBinInContainer(int bin, SummaryContainer &targetContainer, SummaryContainer &sourceContainer)
void fillTrackQuantities(const edm::Event &, std::vector< AVTrackStruct > &v_avtrackout)
const bool moduleLevelHistsTransient_
bool isEndCap(uint32_t subDetId)
unsigned int wheel() const
wheel id
unsigned int layer() const
layer id
void clear()
set to empty values
void bookGlobalHists(DirectoryWrapper &tfd)
DirectoryWrapper(const DirectoryWrapper &upDir, const std::string &newDir, const std::string &basedir, bool useDqmMode)
virtual const DetIdContainer & detUnitIds() const
Returm a vector of all GeomDetUnit DetIds.
unsigned int ring() const
ring id
TrackerOfflineValidation::SummaryContainer bookSummaryHists(DirectoryWrapper &tfd, const Alignable &ali, align::StructureType type, int i, const AlignableObjectId &aliobjid)
T * make() const
make new ROOT object
bool isDoubleSide() const
unsigned int side() const
positive or negative id
TProfile * ResXvsXProfile
std::vector< TH1 * > vTrackProfiles_
std::pair< int, int > typeAndLayerFromDetId(const DetId &detId) const
unsigned int module() const
detector id
std::map< int, TrackerOfflineValidation::ModuleHistos > mPxbResiduals_
std::string histNameNormY
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Detector det() const
get the detector field from this detid
const edm::ParameterSet parSet_
TrackerOfflineValidation(const edm::ParameterSet &)
float Fwhm(const TH1 *hist) const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
tuple size
Write out results.
TProfile * ResYvsXProfile
bool isDoubleSide() const
unsigned int wheel() const
wheel id
bool isBarrel(uint32_t subDetId)