CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
SurveyDataConverter Class Reference

#include <Alignment/SurveyDataConverter/interface/SurveyDataConverter.h>

Inheritance diagram for SurveyDataConverter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void endJob () override
 
 SurveyDataConverter (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef SurveyDataReader::MapType MapType
 
typedef SurveyDataReader::MapTypeOr MapTypeOr
 
typedef SurveyDataReader::PairType PairType
 
typedef SurveyDataReader::PairTypeOr PairTypeOr
 

Private Member Functions

void applyAPEs (TrackerAlignment &tr_align)
 
void applyCoarseSurveyInfo (TrackerAlignment &tr_align)
 
void applyFineSurveyInfo (TrackerAlignment &tr_align, const MapType &map)
 

Private Attributes

bool adderrors
 
bool applycoarseinfo
 
bool applyfineinfo
 
edm::ParameterSet MisalignScenario
 
edm::ParameterSet theParameterSet
 

Static Private Attributes

static const int NFILES = 2
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Reads survey corrections and applies them to the geometry.

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

Definition at line 26 of file SurveyDataConverter.h.

Member Typedef Documentation

Definition at line 29 of file SurveyDataConverter.h.

Definition at line 31 of file SurveyDataConverter.h.

Definition at line 30 of file SurveyDataConverter.h.

Definition at line 32 of file SurveyDataConverter.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file SurveyDataConverter.cc.

18  :
19  theParameterSet( iConfig )
20 {
21 }
edm::ParameterSet theParameterSet

Member Function Documentation

void SurveyDataConverter::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 24 of file SurveyDataConverter.cc.

References adderrors, applyAPEs(), applycoarseinfo, applyCoarseSurveyInfo(), applyfineinfo, applyFineSurveyInfo(), gather_cfg::cout, SurveyDataReader::detIdMap(), Exception, edm::EventSetup::get(), edm::ParameterSet::getParameter(), cuy::ii, NFILES, edm::ESHandle< T >::product(), SurveyDataReader::readFile(), TrackerAlignment::saveToDB(), AlCaHLTBitMon_QueryRunRegistry::string, and theParameterSet.

25 {
26  //Retrieve tracker topology from geometry
28  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
29  const TrackerTopology* const tTopo = tTopoHandle.product();
30 
31  edm::LogInfo("SurveyDataConverter") << "Analyzer called";
32  applyfineinfo = theParameterSet.getParameter<bool>("applyFineInfo");
33  applycoarseinfo = theParameterSet.getParameter<bool>("applyCoarseInfo");
34  adderrors = theParameterSet.getParameter<bool>("applyErrors");
35 
36  // Read in the information from the text files
37  edm::ParameterSet textFiles = theParameterSet.getParameter<edm::ParameterSet>( "textFileNames" );
38 
39  std::string textFileNames[NFILES];
40  std::string fileType[NFILES];
41  textFileNames[0] = textFiles.getUntrackedParameter<std::string>("forTIB","NONE");
42  fileType[0] = "TIB";
43  textFileNames[1] = textFiles.getUntrackedParameter<std::string>("forTID","NONE");
44  fileType[1] = "TID";
45 
46  SurveyDataReader dataReader;
47  for (int ii=0 ; ii<NFILES ;ii++) {
48  if ( textFileNames[ii] == "NONE" )
49  throw cms::Exception("BadConfig") << fileType[ii] << " input file not found in configuration";
50  dataReader.readFile( textFileNames[ii], fileType[ii], tTopo );
51  }
52 
53  // Get info and map
54  const MapType& mapIdToInfo = dataReader.detIdMap();
55  std::cout << "DATA HAS BEEN READ INTO THE MAP" << std::endl;
56  std::cout << "DATA HAS BEEN CONVERTED IN ALIGNABLE COORDINATES" << std::endl;
57 
58  TrackerAlignment tr_align( iSetup );
59  if (applycoarseinfo) this->applyCoarseSurveyInfo(tr_align);
60  if (applyfineinfo) this->applyFineSurveyInfo(tr_align, mapIdToInfo);
61  if (adderrors) this->applyAPEs(tr_align);
62  tr_align.saveToDB();
63 }
T getParameter(std::string const &) const
SurveyDataReader::MapType MapType
void applyFineSurveyInfo(TrackerAlignment &tr_align, const MapType &map)
void applyCoarseSurveyInfo(TrackerAlignment &tr_align)
void applyAPEs(TrackerAlignment &tr_align)
edm::ParameterSet theParameterSet
ii
Definition: cuy.py:589
const MapType & detIdMap() const
static const int NFILES
void readFile(const std::string &textFileName, const std::string &fileType, const TrackerTopology *tTopo)
Read given text file.
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86
void SurveyDataConverter::applyAPEs ( TrackerAlignment tr_align)
private

Definition at line 107 of file SurveyDataConverter.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, AlignableTracker::endcapGeomDets(), AlignableTracker::endcapLayers(), AlignableTracker::endcapPetals(), AlignableTracker::endCaps(), TrackerAlignment::getAlignableTracker(), edm::ParameterSet::getParameter(), AlignableTracker::innerBarrelGeomDets(), AlignableTracker::innerBarrelLayers(), AlignableTracker::innerHalfBarrels(), AlignableTracker::outerBarrelGeomDets(), AlignableTracker::outerBarrelRods(), AlignableTracker::outerHalfBarrels(), theParameterSet, AlignableTracker::TIDGeomDets(), AlignableTracker::TIDLayers(), AlignableTracker::TIDRings(), and AlignableTracker::TIDs().

Referenced by analyze().

107  {
108 
109  std::cout << "Apply APEs: " << std::endl;
110  // Neglect sensor-on-module mounting precision (10 um)
111  // Irrelevant given other sizes ..
112  std::vector<double> TIBerrors = theParameterSet.getParameter< std::vector<double> >("TIBerrors");
113  std::vector<double> TOBerrors = theParameterSet.getParameter< std::vector<double> >("TOBerrors");
114  std::vector<double> TIDerrors = theParameterSet.getParameter< std::vector<double> >("TIDerrors");
115  std::vector<double> TECerrors = theParameterSet.getParameter< std::vector<double> >("TECerrors");
116 
117  if (TIBerrors.size() < 3 || TOBerrors.size() < 4 || TIDerrors.size() < 4 || TECerrors.size() < 4) {
118  std::cout << "APE info not valid : please check test/run-converter.cfg" << std::endl;
119  return;
120  }
121 
122  AlignableModifier theModifier{};
123  AlignableTracker* theAlignableTracker = tr_align.getAlignableTracker() ;
124  align::Alignables::const_iterator iter;
125 
126  // TIB
127  const align::Alignables& theTIBhb = theAlignableTracker->innerHalfBarrels();
128  for (iter = theTIBhb.begin(); iter != theTIBhb.end(); ++iter )
129  { theModifier.addAlignmentPositionErrorLocal( *iter, TIBerrors.at(0),
130  TIBerrors.at(0), TIBerrors.at(0) ); }
131  const align::Alignables& theTIBlayers = theAlignableTracker->innerBarrelLayers();
132  for (iter = theTIBlayers.begin(); iter != theTIBlayers.end(); ++iter)
133  { theModifier.addAlignmentPositionErrorLocal( *iter, TIBerrors.at(1),
134  TIBerrors.at(1), TIBerrors.at(1) ); }
135  const align::Alignables& theTIBgd = theAlignableTracker->innerBarrelGeomDets();
136  for (iter = theTIBgd.begin(); iter != theTIBgd.end(); ++iter )
137  { theModifier.addAlignmentPositionErrorLocal( *iter, TIBerrors.at(2),
138  TIBerrors.at(2), TIBerrors.at(2) ); }
139 
140  // TOB
141  const align::Alignables& theTOBhb = theAlignableTracker->outerHalfBarrels();
142  for (iter = theTOBhb.begin(); iter != theTOBhb.end(); ++iter )
143  { theModifier.addAlignmentPositionErrorLocal( *iter, TOBerrors.at(0),
144  TOBerrors.at(0), TOBerrors.at(1) ); }
145  const align::Alignables& theTOBrods = theAlignableTracker->outerBarrelRods();
146  for (iter = theTOBrods.begin(); iter != theTOBrods.end(); ++iter )
147  { theModifier.addAlignmentPositionErrorLocal( *iter, TOBerrors.at(2),
148  TOBerrors.at(2), TOBerrors.at(2) ); }
149  const align::Alignables& theTOBgd = theAlignableTracker->outerBarrelGeomDets();
150  for (iter = theTOBgd.begin(); iter != theTOBgd.end(); ++iter )
151  { theModifier.addAlignmentPositionErrorLocal( *iter, TOBerrors.at(3),
152  TOBerrors.at(3), TOBerrors.at(3) ); }
153 
154  // TID
155  const align::Alignables& theTIDs = theAlignableTracker->TIDs();
156  for (iter = theTIDs.begin(); iter != theTIDs.end(); ++iter )
157  { theModifier.addAlignmentPositionErrorLocal( *iter, TIDerrors.at(0),
158  TIDerrors.at(0), TIDerrors.at(0) ); }
159  const align::Alignables& theTIDdiscs = theAlignableTracker->TIDLayers();
160  for (iter = theTIDdiscs.begin(); iter != theTIDdiscs.end(); ++iter )
161  { theModifier.addAlignmentPositionErrorLocal( *iter, TIDerrors.at(1),
162  TIDerrors.at(1), TIDerrors.at(1) ); }
163  const align::Alignables& theTIDrings = theAlignableTracker->TIDRings();
164  for (iter = theTIDrings.begin(); iter != theTIDrings.end(); ++iter )
165  { theModifier.addAlignmentPositionErrorLocal( *iter, TIDerrors.at(2),
166  TIDerrors.at(2), TIDerrors.at(2) ); }
167  const align::Alignables& theTIDgd = theAlignableTracker->TIDGeomDets();
168  for (iter = theTIDgd.begin(); iter != theTIDgd.end(); ++iter )
169  { theModifier.addAlignmentPositionErrorLocal( *iter, TIDerrors.at(3),
170  TIDerrors.at(3), TIDerrors.at(3) ); }
171 
172  // TEC
173  const align::Alignables& theTECs = theAlignableTracker->endCaps();
174  for (iter = theTECs.begin(); iter != theTECs.end(); ++iter )
175  { theModifier.addAlignmentPositionErrorLocal( *iter, TECerrors.at(0),
176  TECerrors.at(0), TECerrors.at(0) ); }
177  const align::Alignables& theTECdiscs = theAlignableTracker->endcapLayers();
178  for (iter = theTECdiscs.begin(); iter != theTECdiscs.end(); ++iter )
179  { theModifier.addAlignmentPositionErrorLocal( *iter, TECerrors.at(1),
180  TECerrors.at(1), TECerrors.at(1) ); }
181  const align::Alignables& theTECpetals = theAlignableTracker->endcapPetals();
182  for (iter = theTECpetals.begin(); iter != theTECpetals.end(); ++iter )
183  { theModifier.addAlignmentPositionErrorLocal( *iter, TECerrors.at(2),
184  TECerrors.at(2), TECerrors.at(2) ); }
185  const align::Alignables& theTECgd = theAlignableTracker->endcapGeomDets();
186  for (iter = theTECgd.begin(); iter != theTECgd.end(); ++iter )
187  { theModifier.addAlignmentPositionErrorLocal( *iter, TECerrors.at(3),
188  TECerrors.at(3), TECerrors.at(3) ); }
189 }
T getParameter(std::string const &) const
Alignables & innerBarrelGeomDets()
Return inner barrel GeomDets.
Alignables & endCaps()
Return TECs.
Alignables & TIDGeomDets()
Return TID GeomDets.
Alignables & outerBarrelRods()
Return outer barrel rods.
edm::ParameterSet theParameterSet
Alignables & endcapGeomDets()
Return endcap GeomDets.
Alignables & TIDs()
Return TIDs.
Alignables & outerBarrelGeomDets()
Return outer barrel GeomDets.
Alignables & TIDLayers()
Return TID layers.
Alignables & TIDRings()
Return TID rings.
AlignableTracker * getAlignableTracker()
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
Alignables & innerBarrelLayers()
Return inner barrel layers.
Alignables & endcapPetals()
Return encap petals.
Alignables & innerHalfBarrels()
Return TIB half barrels.
Alignables & endcapLayers()
Return endcap layers.
Alignables & outerHalfBarrels()
Return TOB half barrels.
void SurveyDataConverter::applyCoarseSurveyInfo ( TrackerAlignment tr_align)
private

Definition at line 95 of file SurveyDataConverter.cc.

References TrackerScenarioBuilder::applyScenario(), gather_cfg::cout, TrackerAlignment::getAlignableTracker(), edm::ParameterSet::getParameter(), MisalignScenario, and theParameterSet.

Referenced by analyze().

95  {
96 
97  std::cout << "Apply coarse info: " << std::endl;
99 
100  TrackerScenarioBuilder scenarioBuilder( tr_align.getAlignableTracker() );
101  scenarioBuilder.applyScenario( MisalignScenario );
102 
103 }
T getParameter(std::string const &) const
edm::ParameterSet MisalignScenario
edm::ParameterSet theParameterSet
AlignableTracker * getAlignableTracker()
void applyScenario(const edm::ParameterSet &scenario) override
Apply misalignment scenario to the tracker.
Builds a scenario from configuration and applies it to the alignable tracker.
void SurveyDataConverter::applyFineSurveyInfo ( TrackerAlignment tr_align,
const MapType map 
)
private

Definition at line 67 of file SurveyDataConverter.cc.

References gather_cfg::cout, plotBeamSpotDB::first, TrackerAlignment::moveAlignableTIBTIDs(), and edm::second().

Referenced by analyze().

67  {
68 
69  std::cout << "Apply fine info: " << std::endl;
70 
71  for ( MapType::const_iterator it = map.begin(); it != map.end(); it++){
72 
73  const align::Scalars& align_params = (it)->second;
74 
75  align::Scalars translations;
76  translations.push_back(align_params[0]);
77  translations.push_back(align_params[1]);
78  translations.push_back(align_params[2]);
79 
80  align::RotationType bRotation(align_params[6], align_params[9], align_params[3],
81  align_params[7], align_params[10], align_params[4],
82  align_params[8], align_params[11], align_params[5]);
83 
84  align::RotationType fRotation(align_params[15], align_params[18], align_params[12],
85  align_params[16], align_params[19], align_params[13],
86  align_params[17], align_params[20], align_params[14]);
87 
88  // Use "false" for debugging only
89  tr_align.moveAlignableTIBTIDs((it)->first, translations, bRotation, fRotation, true);
90  }
91 }
U second(std::pair< T, U > const &p)
std::vector< Scalar > Scalars
Definition: Utilities.h:27
void moveAlignableTIBTIDs(int rawId, const align::Scalars &globalDisplacements, const align::RotationType &backwardRotation, const align::RotationType &forwardRotation, bool toAndFro)
void SurveyDataConverter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 38 of file SurveyDataConverter.h.

Referenced by o2olib.O2ORunMgr::executeJob().

38 {};

Member Data Documentation

bool SurveyDataConverter::adderrors
private

Definition at line 58 of file SurveyDataConverter.h.

Referenced by analyze().

bool SurveyDataConverter::applycoarseinfo
private

Definition at line 58 of file SurveyDataConverter.h.

Referenced by analyze().

bool SurveyDataConverter::applyfineinfo
private

Definition at line 58 of file SurveyDataConverter.h.

Referenced by analyze().

edm::ParameterSet SurveyDataConverter::MisalignScenario
private

Definition at line 54 of file SurveyDataConverter.h.

Referenced by applyCoarseSurveyInfo().

const int SurveyDataConverter::NFILES = 2
staticprivate

Definition at line 42 of file SurveyDataConverter.h.

Referenced by analyze().

edm::ParameterSet SurveyDataConverter::theParameterSet
private

Definition at line 53 of file SurveyDataConverter.h.

Referenced by analyze(), applyAPEs(), and applyCoarseSurveyInfo().