Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-03 01:57:38

0001 #include "Alignment/CommonAlignment/interface/AlignableObjectId.h"
0002 #include "Alignment/CommonAlignment/interface/SurveyResidual.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 
0005 #include "Alignment/CommonAlignmentMonitor/plugins/AlignmentMonitorSurvey.h"
0006 
0007 AlignmentMonitorSurvey::AlignmentMonitorSurvey(const edm::ParameterSet& cfg, edm::ConsumesCollector iC)
0008     : AlignmentMonitorBase(cfg, iC, "AlignmentMonitorSurvey"),
0009       levelNames_(cfg.getUntrackedParameter<std::vector<std::string> >("surveyResiduals")) {}
0010 
0011 void AlignmentMonitorSurvey::book() {
0012   align::ID id;
0013   align::StructureType level;
0014 
0015   // fill 'theLevels' only once (and only if necessary)
0016   if (theLevels.empty() && !levelNames_.empty()) {
0017     auto alignableObjectId = AlignableObjectId::commonObjectIdProvider(pTracker(), pMuon());
0018     for (const auto& levelName : levelNames_) {
0019       theLevels.push_back(alignableObjectId.stringToId(levelName));
0020     }
0021   }
0022 
0023   double par[6];  // survey residual
0024 
0025   TTree* tree = directory("/iterN/")->make<TTree>("survey", "");
0026 
0027   tree->Branch("id", &id, "id/i");
0028   tree->Branch("level", &level, "level/I");
0029   tree->Branch("par", &par, "par[6]/D");
0030 
0031   const align::Alignables& all = pStore()->alignables();
0032 
0033   const unsigned int nAlignable = all.size();
0034 
0035   for (unsigned int i = 0; i < nAlignable; ++i) {
0036     const Alignable* ali = all[i];
0037 
0038     id = ali->id();
0039 
0040     for (unsigned int l = 0; l < theLevels.size(); ++l) {
0041       level = theLevels[l];
0042 
0043       SurveyResidual resid(*ali, level, true);
0044       AlgebraicVector resParams = resid.sensorResidual();
0045 
0046       par[0] = resParams[0];
0047       par[1] = resParams[1];
0048       par[2] = resParams[2];
0049       par[3] = resParams[3];
0050       par[4] = resParams[4];
0051       par[5] = resParams[5];
0052 
0053       tree->Fill();
0054     }
0055   }
0056 }
0057 
0058 #include "Alignment/CommonAlignmentMonitor/interface/AlignmentMonitorPluginFactory.h"
0059 DEFINE_EDM_PLUGIN(AlignmentMonitorPluginFactory, AlignmentMonitorSurvey, "AlignmentMonitorSurvey");