CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MuonAlignmentFromReference Class Reference

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

Inheritance diagram for MuonAlignmentFromReference:
AlignmentAlgorithmBase

Public Member Functions

void initialize (const edm::EventSetup &iSetup, AlignableTracker *alignableTracker, AlignableMuon *alignableMuon, AlignableExtras *extras, AlignmentParameterStore *alignmentParameterStore) override
 Call at beginning of job (must be implemented in derived class) More...
 
 MuonAlignmentFromReference (const edm::ParameterSet &cfg)
 
void processMuonResidualsFromTrack (MuonResidualsFromTrack &mrft)
 
void run (const edm::EventSetup &iSetup, const EventInfo &eventInfo) override
 Run the algorithm (must be implemented in derived class) More...
 
void startNewLoop () override
 
void terminate (const edm::EventSetup &iSetup) override
 Call at end of each loop (must be implemented in derived class) More...
 
virtual ~MuonAlignmentFromReference ()
 
- Public Member Functions inherited from AlignmentAlgorithmBase
virtual bool addCalibrations (const std::vector< IntegratedCalibrationBase * > &iCals)
 
 AlignmentAlgorithmBase (const edm::ParameterSet &cfg)
 Constructor. More...
 
virtual void beginLuminosityBlock (const edm::EventSetup &setup)
 called at begin of luminosity block (no lumi block info passed yet) More...
 
virtual void beginRun (const edm::EventSetup &setup)
 called at begin of run More...
 
virtual void endLuminosityBlock (const edm::EventSetup &setup)
 called at end of luminosity block (no lumi block info passed yet) More...
 
virtual void endRun (const EndRunInfo &runInfo, const edm::EventSetup &setup)
 called at end of run - order of arguments like in EDProducer etc. More...
 
virtual bool setParametersForRunRange (const RunRange &rr)
 
virtual ~AlignmentAlgorithmBase ()
 Destructor. More...
 

Private Member Functions

void bookNtuple ()
 
std::string chamberPrettyNameFromId (unsigned int idx)
 
void correctBField ()
 
void eraseNotSelectedResiduals ()
 
void fillNtuple ()
 
void fitAndAlign ()
 
int number (std::string s)
 
bool numeric (std::string s)
 
void parseReference (std::vector< Alignable * > &reference, std::vector< Alignable * > &all_DT_chambers, std::vector< Alignable * > &all_CSC_chambers)
 
void readTmpFiles ()
 
void selectResidualsPeaks ()
 
void writeTmpFiles ()
 

Private Attributes

AlignableNavigatorm_alignableNavigator
 
std::vector< Alignable * > m_alignables
 
AlignmentParameterStorem_alignmentParameterStore
 
bool m_allowTIDTEC
 
int m_BFieldCorrection
 
bool m_combineME11
 
long m_counter_csc
 
long m_counter_cscaligning
 
long m_counter_cschits
 
long m_counter_cscvalid
 
long m_counter_events
 
long m_counter_minchambers
 
long m_counter_resslopey
 
long m_counter_station123
 
long m_counter_station123aligning
 
long m_counter_station123dt13hits
 
long m_counter_station123dt2hits
 
long m_counter_station123valid
 
long m_counter_station4
 
long m_counter_station4aligning
 
long m_counter_station4hits
 
long m_counter_station4valid
 
long m_counter_totchambers
 
long m_counter_trackdxy
 
long m_counter_trackerchi2
 
long m_counter_trackerhits
 
long m_counter_trackertidtec
 
long m_counter_trackmomentum
 
long m_counter_tracks
 
bool m_createNtuple
 
bool m_doAlignment
 
bool m_doCSC
 
bool m_doDT
 
std::map< unsigned int,
MuonResidualsTwoBin * > 
m_fitterOrder
 
std::map< Alignable
*, MuonResidualsTwoBin * > 
m_fitters
 
std::vector< unsigned int > m_indexes
 
double m_maxDxy
 
double m_maxResSlopeY
 
double m_maxTrackerRedChi2
 
double m_maxTrackP
 
double m_maxTrackPt
 
std::map< Alignable
*, Alignable * > 
m_me11map
 
int m_minAlignmentHits
 
int m_minCSCHits
 
int m_minDT13Hits
 
int m_minDT2Hits
 
int m_minNCrossedChambers
 
int m_minTrackerHits
 
double m_minTrackP
 
double m_minTrackPt
 
edm::InputTag m_muonCollectionTag
 
double m_peakNSigma
 
std::vector< std::string > m_readTemporaryFiles
 
std::vector< std::string > m_reference
 
std::string m_reportFileName
 
std::string m_residualsModel
 
int m_strategy
 
MuonResidualsFitter::MuonAlignmentTreeRow m_tree_row
 
TTree * m_ttree
 
bool m_twoBin
 
std::string m_useResiduals
 
bool m_weightAlignment
 
std::string m_writeTemporaryFile
 

Additional Inherited Members

- Public Types inherited from AlignmentAlgorithmBase
typedef std::pair< const
Trajectory *, const
reco::Track * > 
ConstTrajTrackPair
 
typedef std::vector
< ConstTrajTrackPair
ConstTrajTrackPairCollection
 
typedef cond::RealTimeType
< cond::runnumber >::type 
RunNumber
 
typedef std::pair< RunNumber,
RunNumber
RunRange
 

Detailed Description

Description: <one line="" class="" summary>="">

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

Definition at line 69 of file MuonAlignmentFromReference.cc.

Constructor & Destructor Documentation

MuonAlignmentFromReference::MuonAlignmentFromReference ( const edm::ParameterSet cfg)

Definition at line 183 of file MuonAlignmentFromReference.cc.

References bookNtuple(), TFileService::file(), m_counter_csc, m_counter_cscaligning, m_counter_cschits, m_counter_cscvalid, m_counter_events, m_counter_minchambers, m_counter_resslopey, m_counter_station123, m_counter_station123aligning, m_counter_station123dt13hits, m_counter_station123dt2hits, m_counter_station123valid, m_counter_station4, m_counter_station4aligning, m_counter_station4hits, m_counter_station4valid, m_counter_totchambers, m_counter_trackdxy, m_counter_trackerchi2, m_counter_trackerhits, m_counter_trackertidtec, m_counter_trackmomentum, m_counter_tracks, m_createNtuple, m_doAlignment, m_ttree, and NULL.

185  , m_muonCollectionTag(cfg.getParameter<edm::InputTag>("muonCollectionTag"))
186  , m_reference(cfg.getParameter<std::vector<std::string> >("reference"))
187  , m_minTrackPt(cfg.getParameter<double>("minTrackPt"))
188  , m_maxTrackPt(cfg.getParameter<double>("maxTrackPt"))
189  , m_minTrackP(cfg.getParameter<double>("minTrackP"))
190  , m_maxTrackP(cfg.getParameter<double>("maxTrackP"))
191  , m_maxDxy(cfg.getParameter<double>("maxDxy"))
192  , m_minTrackerHits(cfg.getParameter<int>("minTrackerHits"))
193  , m_maxTrackerRedChi2(cfg.getParameter<double>("maxTrackerRedChi2"))
194  , m_allowTIDTEC(cfg.getParameter<bool>("allowTIDTEC"))
195  , m_minNCrossedChambers(cfg.getParameter<int>("minNCrossedChambers"))
196  , m_minDT13Hits(cfg.getParameter<int>("minDT13Hits"))
197  , m_minDT2Hits(cfg.getParameter<int>("minDT2Hits"))
198  , m_minCSCHits(cfg.getParameter<int>("minCSCHits"))
199  , m_writeTemporaryFile(cfg.getParameter<std::string>("writeTemporaryFile"))
200  , m_readTemporaryFiles(cfg.getParameter<std::vector<std::string> >("readTemporaryFiles"))
201  , m_doAlignment(cfg.getParameter<bool>("doAlignment"))
202  , m_strategy(cfg.getParameter<int>("strategy"))
203  , m_residualsModel(cfg.getParameter<std::string>("residualsModel"))
204  , m_minAlignmentHits(cfg.getParameter<int>("minAlignmentHits"))
205  , m_twoBin(cfg.getParameter<bool>("twoBin"))
206  , m_combineME11(cfg.getParameter<bool>("combineME11"))
207  , m_weightAlignment(cfg.getParameter<bool>("weightAlignment"))
208  , m_reportFileName(cfg.getParameter<std::string>("reportFileName"))
209  , m_maxResSlopeY(cfg.getParameter<double>("maxResSlopeY"))
210  , m_createNtuple(cfg.getParameter<bool>("createNtuple"))
211  , m_peakNSigma(cfg.getParameter<double>("peakNSigma"))
212  , m_BFieldCorrection(cfg.getParameter<int>("bFieldCorrection"))
213  , m_doDT(cfg.getParameter<bool>("doDT"))
214  , m_doCSC(cfg.getParameter<bool>("doCSC"))
215  , m_useResiduals(cfg.getParameter<std::string>("useResiduals"))
216 {
217  // alignment requires a TFile to provide plots to check the fit output
218  // just filling the residuals lists does not
219  // but we don't want to wait until the end of the job to find out that the TFile is missing
220  if (m_doAlignment || m_createNtuple) {
222  TFile &tfile = fs->file();
223  tfile.ls();
224  }
225 
226  m_ttree = NULL;
227  if (m_createNtuple) bookNtuple();
228 
229  m_counter_events = 0;
230  m_counter_tracks = 0;
232  m_counter_trackdxy = 0;
243  m_counter_station4 = 0;
247  m_counter_csc = 0;
248  m_counter_cscvalid = 0;
249  m_counter_cschits = 0;
252 }
T getParameter(std::string const &) const
AlignmentAlgorithmBase(const edm::ParameterSet &cfg)
Constructor.
#define NULL
Definition: scimark2.h:8
std::vector< std::string > m_reference
TFile & file() const
return opened TFile
Definition: TFileService.h:37
std::vector< std::string > m_readTemporaryFiles
MuonAlignmentFromReference::~MuonAlignmentFromReference ( )
virtual

Definition at line 255 of file MuonAlignmentFromReference.cc.

References m_alignableNavigator.

256 {
257  delete m_alignableNavigator;
258 }

Member Function Documentation

void MuonAlignmentFromReference::bookNtuple ( )
private

Definition at line 261 of file MuonAlignmentFromReference.cc.

References MuonResidualsFitter::MuonAlignmentTreeRow::angle_x, MuonResidualsFitter::MuonAlignmentTreeRow::angle_y, MuonResidualsFitter::MuonAlignmentTreeRow::is_dt, MuonResidualsFitter::MuonAlignmentTreeRow::is_plus, m_tree_row, m_ttree, TFileService::make(), MuonResidualsFitter::MuonAlignmentTreeRow::pos_x, MuonResidualsFitter::MuonAlignmentTreeRow::pos_y, MuonResidualsFitter::MuonAlignmentTreeRow::pt, MuonResidualsFitter::MuonAlignmentTreeRow::pz, MuonResidualsFitter::MuonAlignmentTreeRow::q, MuonResidualsFitter::MuonAlignmentTreeRow::res_slope_x, MuonResidualsFitter::MuonAlignmentTreeRow::res_slope_y, MuonResidualsFitter::MuonAlignmentTreeRow::res_x, MuonResidualsFitter::MuonAlignmentTreeRow::res_y, MuonResidualsFitter::MuonAlignmentTreeRow::ring_wheel, MuonResidualsFitter::MuonAlignmentTreeRow::sector, MuonResidualsFitter::MuonAlignmentTreeRow::select, and MuonResidualsFitter::MuonAlignmentTreeRow::station.

Referenced by MuonAlignmentFromReference().

262 {
264  m_ttree = fs->make<TTree>("mual_ttree", "mual_ttree");
265  m_ttree->Branch("is_plus", &m_tree_row.is_plus, "is_plus/O");
266  m_ttree->Branch("is_dt", &m_tree_row.is_dt, "is_dt/O");
267  m_ttree->Branch("station", &m_tree_row.station, "station/b");
268  m_ttree->Branch("ring_wheel", &m_tree_row.ring_wheel, "ring_wheel/B");
269  m_ttree->Branch("sector", &m_tree_row.sector, "sector/b");
270  m_ttree->Branch("res_x", &m_tree_row.res_x, "res_x/F");
271  m_ttree->Branch("res_y", &m_tree_row.res_y, "res_y/F");
272  m_ttree->Branch("res_slope_x", &m_tree_row.res_slope_x, "res_slope_x/F");
273  m_ttree->Branch("res_slope_y", &m_tree_row.res_slope_y, "res_slope_y/F");
274  m_ttree->Branch("pos_x",&m_tree_row.pos_x, "pos_x/F");
275  m_ttree->Branch("pos_y",&m_tree_row.pos_y, "pos_y/F");
276  m_ttree->Branch("angle_x",&m_tree_row.angle_x, "angle_x/F");
277  m_ttree->Branch("angle_y",&m_tree_row.angle_y,"angle_y/F");
278  m_ttree->Branch("pz",&m_tree_row.pz,"pz/F");
279  m_ttree->Branch("pt",&m_tree_row.pt,"pt/F");
280  m_ttree->Branch("q",&m_tree_row.q,"q/B");
281  m_ttree->Branch("select", &m_tree_row.select, "select/O");
282  //m_ttree->Branch("",&m_tree_row.,"/");
283 
284 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
MuonResidualsFitter::MuonAlignmentTreeRow m_tree_row
std::string MuonAlignmentFromReference::chamberPrettyNameFromId ( unsigned int  idx)
private

Definition at line 1678 of file MuonAlignmentFromReference.cc.

References CSCDetId::chamber(), MuonSubdetId::CSC, MuonSubdetId::DT, CSCDetId::endcap(), CSCDetId::ring(), DTChamberId::sector(), DTChamberId::station(), CSCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, and DTChamberId::wheel().

Referenced by correctBField(), eraseNotSelectedResiduals(), and selectResidualsPeaks().

1679 {
1680  DetId id(idx);
1681  char cname[40];
1682  if (id.subdetId() == MuonSubdetId::DT)
1683  {
1684  DTChamberId chamberId(id.rawId());
1685  sprintf(cname, "MB%+d/%d/%02d", chamberId.wheel(), chamberId.station(), chamberId.sector());
1686  }
1687  else if (id.subdetId() == MuonSubdetId::CSC)
1688  {
1689  CSCDetId chamberId(id.rawId());
1690  sprintf(cname, "ME%s%d/%d/%02d", (chamberId.endcap() == 1 ? "+" : "-"), chamberId.station(), chamberId.ring(), chamberId.chamber());
1691  }
1692  return std::string(cname);
1693 }
static const int CSC
Definition: MuonSubdetId.h:13
Definition: DetId.h:18
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static const int DT
Definition: MuonSubdetId.h:12
void MuonAlignmentFromReference::correctBField ( )
private

Definition at line 1574 of file MuonAlignmentFromReference.cc.

References chamberPrettyNameFromId(), MuonResidualsTwoBin::correctBField(), gather_cfg::cout, cmsHarvester::index, m_fitterOrder, and m_indexes.

Referenced by terminate().

1575 {
1576  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index)
1577  {
1578  std::cout<<"correcting B in "<<chamberPrettyNameFromId(*index)<<std::endl;
1580  fitter->correctBField();
1581  }
1582 }
std::vector< unsigned int > m_indexes
std::string chamberPrettyNameFromId(unsigned int idx)
tuple cout
Definition: gather_cfg.py:121
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
void MuonAlignmentFromReference::eraseNotSelectedResiduals ( )
private

Definition at line 1585 of file MuonAlignmentFromReference.cc.

References chamberPrettyNameFromId(), gather_cfg::cout, MuonResidualsTwoBin::eraseNotSelectedResiduals(), cmsHarvester::index, m_fitterOrder, and m_indexes.

Referenced by terminate().

1586 {
1587  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index)
1588  {
1589  std::cout<<"erasing in "<<chamberPrettyNameFromId(*index)<<std::endl;
1591  fitter->eraseNotSelectedResiduals();
1592  }
1593 }
std::vector< unsigned int > m_indexes
std::string chamberPrettyNameFromId(unsigned int idx)
tuple cout
Definition: gather_cfg.py:121
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
void MuonAlignmentFromReference::fillNtuple ( )
private

Definition at line 1696 of file MuonAlignmentFromReference.cc.

References MuonResidualsFitter::MuonAlignmentTreeRow::angle_x, MuonResidualsFitter::MuonAlignmentTreeRow::angle_y, MuonSubdetId::CSC, DetId::det(), cond::rpcobgas::detid, MuonSubdetId::DT, Reference_intrackfit_cff::endcap, cmsHarvester::index, MuonResidualsFitter::MuonAlignmentTreeRow::is_dt, MuonResidualsFitter::MuonAlignmentTreeRow::is_plus, MuonResidualsFitter::k5DOF, MuonResidualsFitter::k6DOF, MuonResidualsFitter::k6DOFrphi, MuonResiduals5DOFFitter::kAngleX, MuonResiduals6DOFFitter::kAngleX, MuonResiduals5DOFFitter::kAngleY, MuonResiduals6DOFFitter::kAngleY, MuonResiduals5DOFFitter::kCharge, MuonResiduals6DOFFitter::kCharge, MuonResiduals5DOFFitter::kPositionX, MuonResiduals6DOFFitter::kPositionX, MuonResiduals5DOFFitter::kPositionY, MuonResiduals6DOFFitter::kPositionY, MuonResiduals5DOFFitter::kPt, MuonResiduals6DOFFitter::kPt, MuonResiduals5DOFFitter::kPz, MuonResiduals6DOFFitter::kPz, MuonResiduals5DOFFitter::kResid, MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kResidY, MuonResiduals5DOFFitter::kResSlope, MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kResSlopeY, m_fitterOrder, m_indexes, m_tree_row, m_ttree, DetId::Muon, MuonResidualsFitter::MuonAlignmentTreeRow::pos_x, MuonResidualsFitter::MuonAlignmentTreeRow::pos_y, MuonResidualsFitter::MuonAlignmentTreeRow::pt, MuonResidualsFitter::MuonAlignmentTreeRow::pz, MuonResidualsFitter::MuonAlignmentTreeRow::q, MuonResidualsFitter::MuonAlignmentTreeRow::res_slope_x, MuonResidualsFitter::MuonAlignmentTreeRow::res_slope_y, MuonResidualsFitter::MuonAlignmentTreeRow::res_x, MuonResidualsFitter::MuonAlignmentTreeRow::res_y, MuonResidualsTwoBin::residualsPos_begin(), MuonResidualsTwoBin::residualsPos_end(), MuonResidualsTwoBin::residualsPos_ok_begin(), relativeConstraints::ring, MuonResidualsFitter::MuonAlignmentTreeRow::ring_wheel, MuonResidualsFitter::MuonAlignmentTreeRow::sector, MuonResidualsFitter::MuonAlignmentTreeRow::select, relativeConstraints::station, MuonResidualsFitter::MuonAlignmentTreeRow::station, DetId::subdetId(), and MuonResidualsTwoBin::type().

Referenced by terminate().

1697 {
1698  // WARNING: does not support two bin option!!!
1699 
1700  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index)
1701  {
1702  DetId detid(*index);
1703  if (detid.det() != DetId::Muon || !( detid.subdetId() == MuonSubdetId::DT || detid.subdetId() == MuonSubdetId::CSC) ) assert(false);
1704 
1705  if(detid.subdetId() == MuonSubdetId::DT)
1706  {
1707  m_tree_row.is_dt = (Bool_t) true;
1708  DTChamberId id(*index);
1709  m_tree_row.is_plus = (Bool_t) true;
1710  m_tree_row.station = (UChar_t) id.station();
1711  m_tree_row.ring_wheel = (Char_t) id.wheel();
1712  m_tree_row.sector = (UChar_t) id.sector();
1713  }
1714  else
1715  {
1716  m_tree_row.is_dt = (Bool_t) false;
1717  CSCDetId id(*index);
1718  m_tree_row.is_plus = (Bool_t) (id.endcap() == 1);
1719  m_tree_row.station = (UChar_t) id.station();
1720  m_tree_row.ring_wheel = (Char_t) id.ring();
1721  m_tree_row.sector = (UChar_t) id.chamber();
1722  }
1723 
1725 
1726  std::vector<double*>::const_iterator residual = fitter->residualsPos_begin();
1727  std::vector<bool>::const_iterator residual_ok = fitter->residualsPos_ok_begin();
1728  for (; residual != fitter->residualsPos_end(); ++residual, ++residual_ok)
1729  {
1730  if (fitter->type() == MuonResidualsFitter::k5DOF || fitter->type() == MuonResidualsFitter::k6DOFrphi)
1731  {
1732  m_tree_row.res_x = (Float_t) (*residual)[MuonResiduals5DOFFitter::kResid];
1733  m_tree_row.res_y = (Float_t) 0.;
1735  m_tree_row.res_slope_y = (Float_t) 0.;
1736  m_tree_row.pos_x = (Float_t) (*residual)[MuonResiduals5DOFFitter::kPositionX];
1737  m_tree_row.pos_y = (Float_t) (*residual)[MuonResiduals5DOFFitter::kPositionY];
1738  m_tree_row.angle_x = (Float_t) (*residual)[MuonResiduals5DOFFitter::kAngleX];
1739  m_tree_row.angle_y = (Float_t) (*residual)[MuonResiduals5DOFFitter::kAngleY];
1740  m_tree_row.pz = (Float_t) (*residual)[MuonResiduals5DOFFitter::kPz];
1741  m_tree_row.pt = (Float_t) (*residual)[MuonResiduals5DOFFitter::kPt];
1742  m_tree_row.q = (Char_t) (*residual)[MuonResiduals5DOFFitter::kCharge];
1743  m_tree_row.select = (Bool_t) *residual_ok;
1744  }
1745  else if (fitter->type() == MuonResidualsFitter::k6DOF)
1746  {
1747  m_tree_row.res_x = (Float_t) (*residual)[MuonResiduals6DOFFitter::kResidX];
1748  m_tree_row.res_y = (Float_t) (*residual)[MuonResiduals6DOFFitter::kResidY];
1751  m_tree_row.pos_x = (Float_t) (*residual)[MuonResiduals6DOFFitter::kPositionX];
1752  m_tree_row.pos_y = (Float_t) (*residual)[MuonResiduals6DOFFitter::kPositionY];
1753  m_tree_row.angle_x = (Float_t) (*residual)[MuonResiduals6DOFFitter::kAngleX];
1754  m_tree_row.angle_y = (Float_t) (*residual)[MuonResiduals6DOFFitter::kAngleY];
1755  m_tree_row.pz = (Float_t) (*residual)[MuonResiduals6DOFFitter::kPz];
1756  m_tree_row.pt = (Float_t) (*residual)[MuonResiduals6DOFFitter::kPt];
1757  m_tree_row.q = (Char_t) (*residual)[MuonResiduals6DOFFitter::kCharge];
1758  m_tree_row.select = (Bool_t) *residual_ok;
1759  }
1760  else assert(false);
1761 
1762  m_ttree->Fill();
1763  }
1764  }
1765 }
std::vector< double * >::const_iterator residualsPos_end() const
std::vector< bool >::const_iterator residualsPos_ok_begin() const
MuonResidualsFitter::MuonAlignmentTreeRow m_tree_row
std::vector< unsigned int > m_indexes
static const int CSC
Definition: MuonSubdetId.h:13
Definition: DetId.h:18
static const int DT
Definition: MuonSubdetId.h:12
std::vector< double * >::const_iterator residualsPos_begin() const
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
void MuonAlignmentFromReference::fitAndAlign ( )
private

Definition at line 933 of file MuonAlignmentFromReference.cc.

References AlignmentParameterStore::applyParameters(), CSCDetId::chamber(), AlignmentParameters::cloneFromSelected(), gather_cfg::cout, MuonSubdetId::CSC, MuonSubdetId::DT, CSCDetId::endcap(), i, MuonResidualsFitter::k5DOF, MuonResidualsFitter::k6DOF, MuonResidualsFitter::k6DOFrphi, MuonResiduals5DOFFitter::kAlignPhiX, MuonResiduals6DOFFitter::kAlignPhiX, MuonResiduals6DOFrphiFitter::kAlignPhiX, MuonResiduals5DOFFitter::kAlignPhiY, MuonResiduals6DOFFitter::kAlignPhiY, MuonResiduals6DOFrphiFitter::kAlignPhiY, MuonResiduals5DOFFitter::kAlignPhiZ, MuonResiduals6DOFFitter::kAlignPhiZ, MuonResiduals6DOFrphiFitter::kAlignPhiZ, MuonResiduals5DOFFitter::kAlignX, MuonResiduals6DOFFitter::kAlignX, MuonResiduals6DOFrphiFitter::kAlignX, MuonResiduals6DOFFitter::kAlignY, MuonResiduals6DOFrphiFitter::kAlignY, MuonResiduals5DOFFitter::kAlignZ, MuonResiduals6DOFFitter::kAlignZ, MuonResiduals6DOFrphiFitter::kAlignZ, MuonResidualsFitter::kGaussPowerTails, MuonResidualsFitter::kPureGaussian, MuonResidualsFitter::kPureGaussian2D, MuonResiduals5DOFFitter::kRedChi2, MuonResiduals6DOFrphiFitter::kRedChi2, MuonResiduals6DOFFitter::kRedChi2, MuonResiduals5DOFFitter::kResid, MuonResiduals6DOFrphiFitter::kResid, MuonResiduals5DOFFitter::kResidGamma, MuonResiduals6DOFrphiFitter::kResidGamma, MuonResiduals5DOFFitter::kResidSigma, MuonResiduals6DOFrphiFitter::kResidSigma, MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kResidXGamma, MuonResiduals6DOFFitter::kResidXSigma, MuonResiduals6DOFFitter::kResidY, MuonResiduals6DOFFitter::kResidYGamma, MuonResiduals6DOFFitter::kResidYSigma, MuonResiduals5DOFFitter::kResSlope, MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals5DOFFitter::kResSlopeGamma, MuonResiduals6DOFrphiFitter::kResSlopeGamma, MuonResiduals5DOFFitter::kResSlopeSigma, MuonResiduals6DOFrphiFitter::kResSlopeSigma, MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kResSlopeXGamma, MuonResiduals6DOFFitter::kResSlopeXSigma, MuonResiduals6DOFFitter::kResSlopeY, MuonResiduals6DOFFitter::kResSlopeYGamma, MuonResiduals6DOFFitter::kResSlopeYSigma, m_alignables, m_alignmentParameterStore, m_combineME11, m_fitters, m_me11map, m_minAlignmentHits, m_reportFileName, TFileService::mkdir(), zeeHLT_cff::report, CSCDetId::ring(), DTChamberId::sector(), AlignmentParameterStore::setAlignmentPositionError(), DTChamberId::station(), CSCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, and DTChamberId::wheel().

Referenced by terminate().

934 {
935  edm::Service<TFileService> tfileService;
936  TFileDirectory rootDirectory(tfileService->mkdir("MuonAlignmentFromReference"));
937 
938  std::ofstream report;
939  bool writeReport = (m_reportFileName != std::string(""));
940  if (writeReport)
941  {
942  report.open(m_reportFileName.c_str());
943  report << "nan = None; NAN = None" << std::endl;
944  report << "reports = []" << std::endl;
945  report << "class ValErr:" << std::endl
946  << " def __init__(self, value, error, antisym):" << std::endl
947  << " self.value, self.error, self.antisym = value, error, antisym" << std::endl
948  << "" << std::endl
949  << " def __repr__(self):" << std::endl
950  << " if self.antisym == 0.:" << std::endl
951  << " return \"%g +- %g\" % (self.value, self.error)" << std::endl
952  << " else:" << std::endl
953  << " return \"%g +- %g ~ %g\" % (self.value, self.error, self.antisym)" << std::endl
954  << "" << std::endl
955  << "class Report:" << std::endl
956  << " def __init__(self, chamberId, postal_address, name):" << std::endl
957  << " self.chamberId, self.postal_address, self.name = chamberId, postal_address, name" << std::endl
958  << " self.status = \"NOFIT\"" << std::endl
959  << " self.fittype = None" << std::endl
960  << "" << std::endl
961  << " def add_parameters(self, deltax, deltay, deltaz, deltaphix, deltaphiy, deltaphiz, loglikelihood, numsegments, sumofweights, redchi2):" << std::endl
962  << " self.status = \"PASS\"" << std::endl
963  << " self.deltax, self.deltay, self.deltaz, self.deltaphix, self.deltaphiy, self.deltaphiz = deltax, deltay, deltaz, deltaphix, deltaphiy, deltaphiz" << std::endl
964  << " self.loglikelihood, self.numsegments, self.sumofweights, self.redchi2 = loglikelihood, numsegments, sumofweights, redchi2" << std::endl
965  << "" << std::endl
966  << " def add_stats(self, median_x, median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, mean50_dydz, mean15_x, mean15_y, mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, wmean50_dydz, wmean15_x, wmean15_y, wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, stdev50_dydz, stdev15_x, stdev15_y, stdev10_dxdz, stdev25_dydz):" << std::endl
967  << " self.median_x, self.median_y, self.median_dxdz, self.median_dydz, self.mean30_x, self.mean30_y, self.mean20_dxdz, self.mean50_dydz, self.mean15_x, self.mean15_y, self.mean10_dxdz, self.mean25_dydz, self.wmean30_x, self.wmean30_y, self.wmean20_dxdz, self.wmean50_dydz, self.wmean15_x, self.wmean15_y, self.wmean10_dxdz, self.wmean25_dydz, self.stdev30_x, self.stdev30_y, self.stdev20_dxdz, self.stdev50_dydz, self.stdev15_x, self.stdev15_y, self.stdev10_dxdz, self.stdev25_dydz = median_x, median_y, median_dxdz, median_dydz, mean30_x, mean30_y, mean20_dxdz, mean50_dydz, mean15_x, mean15_y, mean10_dxdz, mean25_dydz, wmean30_x, wmean30_y, wmean20_dxdz, wmean50_dydz, wmean15_x, wmean15_y, wmean10_dxdz, wmean25_dydz, stdev30_x, stdev30_y, stdev20_dxdz, stdev50_dydz, stdev15_x, stdev15_y, stdev10_dxdz, stdev25_dydz" << std::endl
968  << "" << std::endl
969  << " def __repr__(self):" << std::endl
970  << " return \"<Report %s %s %s>\" % (self.postal_address[0], \" \".join(map(str, self.postal_address[1:])), self.status)"<< std::endl
971  << std::endl;
972  }
973 
974  for (std::vector<Alignable*>::const_iterator ali = m_alignables.begin(); ali != m_alignables.end(); ++ali)
975  {
976  std::vector<bool> selector = (*ali)->alignmentParameters()->selector();
977  bool align_x = selector[0];
978  bool align_y = selector[1];
979  bool align_z = selector[2];
980  bool align_phix = selector[3];
981  bool align_phiy = selector[4];
982  bool align_phiz = selector[5];
983  int numParams = ((align_x ? 1 : 0) + (align_y ? 1 : 0) + (align_z ? 1 : 0) + (align_phix ? 1 : 0) + (align_phiy ? 1 : 0) + (align_phiz ? 1 : 0));
984 
985  // map from 0-5 to the index of params, above
986  std::vector<int> paramIndex;
987  int paramIndex_counter = -1;
988  if (align_x) paramIndex_counter++;
989  paramIndex.push_back(paramIndex_counter);
990  if (align_y) paramIndex_counter++;
991  paramIndex.push_back(paramIndex_counter);
992  if (align_z) paramIndex_counter++;
993  paramIndex.push_back(paramIndex_counter);
994  if (align_phix) paramIndex_counter++;
995  paramIndex.push_back(paramIndex_counter);
996  if (align_phiy) paramIndex_counter++;
997  paramIndex.push_back(paramIndex_counter);
998  if (align_phiz) paramIndex_counter++;
999  paramIndex.push_back(paramIndex_counter);
1000 
1001  DetId id = (*ali)->geomDetId();
1002 
1003  Alignable *thisali = *ali;
1004  if (m_combineME11 && id.subdetId() == MuonSubdetId::CSC)
1005  {
1006  CSCDetId cscid(id.rawId());
1007  if (cscid.station() == 1 && cscid.ring() == 4) thisali = m_me11map[*ali];
1008  }
1009 
1010  char cname[40];
1011  char wheel_label[][2]={"A","B","C","D","E"};
1012 
1013  if (id.subdetId() == MuonSubdetId::DT)
1014  {
1015  DTChamberId chamberId(id.rawId());
1016 
1017  //if ( ! ( (chamberId.station()==1&&chamberId.wheel()==0) || (chamberId.station()==4&&chamberId.wheel()==2) ) ) continue;
1018 
1019  sprintf(cname, "MBwh%sst%dsec%02d", wheel_label[chamberId.wheel()+2], chamberId.station(), chamberId.sector());
1020  if (writeReport)
1021  {
1022  report << "reports.append(Report(" << id.rawId() << ", (\"DT\", "
1023  << chamberId.wheel() << ", " << chamberId.station() << ", " << chamberId.sector() << "), \"" << cname << "\"))" << std::endl;
1024  }
1025  }
1026  else if (id.subdetId() == MuonSubdetId::CSC)
1027  {
1028  CSCDetId chamberId(id.rawId());
1029  sprintf(cname, "ME%s%d%d_%02d", (chamberId.endcap() == 1 ? "p" : "m"), chamberId.station(), chamberId.ring(), chamberId.chamber());
1030 
1031  //if ( chamberId.chamber()>6 || chamberId.endcap()==2 || ! ( (chamberId.station()==2&&chamberId.ring()==1) || (chamberId.station()==3&&chamberId.ring()==2) ) ) continue;
1032 
1033  if (writeReport)
1034  {
1035  report << "reports.append(Report(" << id.rawId() << ", (\"CSC\", "
1036  << chamberId.endcap() << ", " << chamberId.station() << ", " << chamberId.ring() << ", " << chamberId.chamber()
1037  << "), \"" << cname << "\"))" << std::endl;
1038  }
1039  }
1040 
1041  //if(! ( strcmp(cname,"MBwhCst3sec12")==0 || strcmp(cname,"MBwhCst3sec06")==0)) continue;
1042 
1043  std::map<Alignable*, MuonResidualsTwoBin*>::const_iterator fitter = m_fitters.find(thisali);
1044 
1045  if (fitter != m_fitters.end())
1046  {
1047  //if (fitter->second->type() != MuonResidualsFitter::k6DOFrphi) continue;
1048 
1049  TStopwatch stop_watch;
1050  stop_watch.Start();
1051 
1052  // MINUIT is verbose in std::cout anyway
1053  std::cout << "=============================================================================================" << std::endl;
1054  std::cout << "Fitting " << cname << std::endl;
1055 
1056  if (writeReport)
1057  {
1058  report << "reports[-1].posNum = " << fitter->second->numResidualsPos() << std::endl;
1059  report << "reports[-1].negNum = " << fitter->second->numResidualsNeg() << std::endl;
1060  }
1061 
1062  if (fitter->second->type() == MuonResidualsFitter::k5DOF)
1063  {
1064  if (!align_x) fitter->second->fix(MuonResiduals5DOFFitter::kAlignX);
1065  if (!align_z) fitter->second->fix(MuonResiduals5DOFFitter::kAlignZ);
1066  if (!align_phix) fitter->second->fix(MuonResiduals5DOFFitter::kAlignPhiX);
1067  if (!align_phiy) fitter->second->fix(MuonResiduals5DOFFitter::kAlignPhiY);
1068  if (!align_phiz) fitter->second->fix(MuonResiduals5DOFFitter::kAlignPhiZ);
1069  }
1070  else if (fitter->second->type() == MuonResidualsFitter::k6DOF)
1071  {
1072  if (!align_x) fitter->second->fix(MuonResiduals6DOFFitter::kAlignX);
1073  if (!align_y) fitter->second->fix(MuonResiduals6DOFFitter::kAlignY);
1074  if (!align_z) fitter->second->fix(MuonResiduals6DOFFitter::kAlignZ);
1075  if (!align_phix) fitter->second->fix(MuonResiduals6DOFFitter::kAlignPhiX);
1076  if (!align_phiy) fitter->second->fix(MuonResiduals6DOFFitter::kAlignPhiY);
1077  if (!align_phiz) fitter->second->fix(MuonResiduals6DOFFitter::kAlignPhiZ);
1078  }
1079  else if (fitter->second->type() == MuonResidualsFitter::k6DOFrphi)
1080  {
1081  if (!align_x) fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignX);
1082  if (!align_y) fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignY);
1083  if (!align_z) fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignZ);
1084  if (!align_phix) fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1085  if (!align_phiy) fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1086  if (!align_phiz) fitter->second->fix(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1087  }
1088  else assert(false);
1089 
1090  AlgebraicVector params(numParams);
1091  AlgebraicSymMatrix cov(numParams);
1092 
1093  if (fitter->second->numsegments() >= m_minAlignmentHits)
1094  {
1095  bool successful_fit = fitter->second->fit(thisali);
1096 
1097  double loglikelihood = fitter->second->loglikelihood();
1098  double numsegments = fitter->second->numsegments();
1099  double sumofweights = fitter->second->sumofweights();
1100  double redchi2 = fitter->second->plot(cname, &rootDirectory, thisali);
1101 
1102  if (fitter->second->type() == MuonResidualsFitter::k5DOF)
1103  {
1104  double deltax_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignX);
1105  double deltax_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignX);
1106  double deltax_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignX);
1107 
1108  double deltaz_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignZ);
1109  double deltaz_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignZ);
1110  double deltaz_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignZ);
1111 
1112  double deltaphix_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignPhiX);
1113  double deltaphix_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignPhiX);
1114  double deltaphix_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignPhiX);
1115 
1116  double deltaphiy_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignPhiY);
1117  double deltaphiy_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignPhiY);
1118  double deltaphiy_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignPhiY);
1119 
1120  double deltaphiz_value = fitter->second->value(MuonResiduals5DOFFitter::kAlignPhiZ);
1121  double deltaphiz_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kAlignPhiZ);
1122  double deltaphiz_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kAlignPhiZ);
1123 
1124  double sigmaresid_value = fitter->second->value(MuonResiduals5DOFFitter::kResidSigma);
1125  double sigmaresid_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResidSigma);
1126  double sigmaresid_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResidSigma);
1127 
1128  double sigmaresslope_value = fitter->second->value(MuonResiduals5DOFFitter::kResSlopeSigma);
1129  double sigmaresslope_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResSlopeSigma);
1130  double sigmaresslope_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResSlopeSigma);
1131 
1132  double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error, gammaresslope_antisym;
1133  gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error = gammaresslope_antisym = 0.;
1134 
1135  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1136  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1137  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails)
1138  {
1139  gammaresid_value = fitter->second->value(MuonResiduals5DOFFitter::kResidGamma);
1140  gammaresid_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResidGamma);
1141  gammaresid_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResidGamma);
1142 
1143  gammaresslope_value = fitter->second->value(MuonResiduals5DOFFitter::kResSlopeGamma);
1144  gammaresslope_error = fitter->second->errorerror(MuonResiduals5DOFFitter::kResSlopeGamma);
1145  gammaresslope_antisym = fitter->second->antisym(MuonResiduals5DOFFitter::kResSlopeGamma);
1146  }
1147 
1148  if (writeReport)
1149  {
1150  report << "reports[-1].fittype = \"5DOF\"" << std::endl;
1151  report << "reports[-1].add_parameters(ValErr(" << deltax_value << ", " << deltax_error << ", " << deltax_antisym << "), \\" << std::endl
1152  << " None, \\" << std::endl
1153  << " ValErr(" << deltaz_value << ", " << deltaz_error << ", " << deltaz_antisym << "), \\" << std::endl
1154  << " ValErr(" << deltaphix_value << ", " << deltaphix_error << ", " << deltaphix_antisym << "), \\" << std::endl
1155  << " ValErr(" << deltaphiy_value << ", " << deltaphiy_error << ", " << deltaphiy_antisym << "), \\" << std::endl
1156  << " ValErr(" << deltaphiz_value << ", " << deltaphiz_error << ", " << deltaphiz_antisym << "), \\" << std::endl
1157  << " " << loglikelihood << ", " << numsegments << ", " << sumofweights << ", " << redchi2 << ")" << std::endl;
1158  report << "reports[-1].sigmaresid = ValErr(" << sigmaresid_value << ", " << sigmaresid_error << ", " << sigmaresid_antisym << ")" << std::endl;
1159  report << "reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value << ", " << sigmaresslope_error << ", " << sigmaresslope_antisym << ")" << std::endl;
1160  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1161  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1162  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails)
1163  {
1164  report << "reports[-1].gammaresid = ValErr(" << gammaresid_value << ", " << gammaresid_error << ", " << gammaresid_antisym << ")" << std::endl;
1165  report << "reports[-1].gammaresslope = ValErr(" << gammaresslope_value << ", " << gammaresslope_error << ", " << gammaresslope_antisym << ")" << std::endl;
1166  }
1167 
1168  report << "reports[-1].add_stats(" << fitter->second->median(MuonResiduals5DOFFitter::kResid) << ", " << "None, "
1169  << fitter->second->median(MuonResiduals5DOFFitter::kResSlope) << ", " << "None, "
1170  << fitter->second->mean(MuonResiduals5DOFFitter::kResid, 30.) << ", " << "None, "
1171  << fitter->second->mean(MuonResiduals5DOFFitter::kResSlope, 20.) << ", " << "None, "
1172  << fitter->second->mean(MuonResiduals5DOFFitter::kResid, 15.) << ", " << "None, "
1173  << fitter->second->mean(MuonResiduals5DOFFitter::kResSlope, 10.) << ", " << "None, "
1174  << fitter->second->wmean(MuonResiduals5DOFFitter::kResid, MuonResiduals5DOFFitter::kRedChi2, 30.) << ", " << "None, "
1175  << fitter->second->wmean(MuonResiduals5DOFFitter::kResSlope, MuonResiduals5DOFFitter::kRedChi2, 20.) << ", " << "None, "
1176  << fitter->second->wmean(MuonResiduals5DOFFitter::kResid, MuonResiduals5DOFFitter::kRedChi2, 15.) << ", " << "None, "
1177  << fitter->second->wmean(MuonResiduals5DOFFitter::kResSlope, MuonResiduals5DOFFitter::kRedChi2, 10.) << ", " << "None, "
1178  << fitter->second->stdev(MuonResiduals5DOFFitter::kResid, 30.) << ", " << "None, "
1179  << fitter->second->stdev(MuonResiduals5DOFFitter::kResSlope, 20.) << ", " << "None, "
1180  << fitter->second->stdev(MuonResiduals5DOFFitter::kResid, 15.) << ", " << "None, "
1181  << fitter->second->stdev(MuonResiduals5DOFFitter::kResSlope, 10.) << ", " << "None)" << std::endl;
1182 
1183  std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1184  namesimple_x << cname << "_simple_x";
1185  namesimple_dxdz << cname << "_simple_dxdz";
1186  nameweighted_x << cname << "_weighted_x";
1187  nameweighted_dxdz << cname << "_weighted_dxdz";
1188 
1189  fitter->second->plotsimple(namesimple_x.str(), &rootDirectory, MuonResiduals5DOFFitter::kResid, 10.);
1190  fitter->second->plotsimple(namesimple_dxdz.str(), &rootDirectory, MuonResiduals5DOFFitter::kResSlope, 1000.);
1191 
1192  fitter->second->plotweighted(nameweighted_x.str(), &rootDirectory, MuonResiduals5DOFFitter::kResid, MuonResiduals5DOFFitter::kRedChi2, 10.);
1193  fitter->second->plotweighted(nameweighted_dxdz.str(), &rootDirectory, MuonResiduals5DOFFitter::kResSlope, MuonResiduals5DOFFitter::kRedChi2, 1000.);
1194  }
1195 
1196  if (successful_fit)
1197  {
1198  if (align_x) params[paramIndex[0]] = deltax_value;
1199  if (align_z) params[paramIndex[2]] = deltaz_value;
1200  if (align_phix) params[paramIndex[3]] = deltaphix_value;
1201  if (align_phiy) params[paramIndex[4]] = deltaphiy_value;
1202  if (align_phiz) params[paramIndex[5]] = deltaphiz_value;
1203  }
1204  } // end if 5DOF
1205 
1206  else if (fitter->second->type() == MuonResidualsFitter::k6DOF)
1207  {
1208  double deltax_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignX);
1209  double deltax_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignX);
1210  double deltax_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignX);
1211 
1212  double deltay_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignY);
1213  double deltay_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignY);
1214  double deltay_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignY);
1215 
1216  double deltaz_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignZ);
1217  double deltaz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignZ);
1218  double deltaz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignZ);
1219 
1220  double deltaphix_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignPhiX);
1221  double deltaphix_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignPhiX);
1222  double deltaphix_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignPhiX);
1223 
1224  double deltaphiy_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignPhiY);
1225  double deltaphiy_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignPhiY);
1226  double deltaphiy_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignPhiY);
1227 
1228  double deltaphiz_value = fitter->second->value(MuonResiduals6DOFFitter::kAlignPhiZ);
1229  double deltaphiz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kAlignPhiZ);
1230  double deltaphiz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kAlignPhiZ);
1231 
1232  double sigmax_value = fitter->second->value(MuonResiduals6DOFFitter::kResidXSigma);
1233  double sigmax_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidXSigma);
1234  double sigmax_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidXSigma);
1235 
1236  double sigmay_value = fitter->second->value(MuonResiduals6DOFFitter::kResidYSigma);
1237  double sigmay_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidYSigma);
1238  double sigmay_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidYSigma);
1239 
1240  double sigmadxdz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeXSigma);
1241  double sigmadxdz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeXSigma);
1242  double sigmadxdz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeXSigma);
1243 
1244  double sigmadydz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeYSigma);
1245  double sigmadydz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeYSigma);
1246  double sigmadydz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeYSigma);
1247 
1248  double gammax_value, gammax_error, gammax_antisym, gammay_value, gammay_error, gammay_antisym,
1249  gammadxdz_value, gammadxdz_error, gammadxdz_antisym, gammadydz_value, gammadydz_error, gammadydz_antisym;
1250  gammax_value = gammax_error = gammax_antisym = gammay_value = gammay_error = gammay_antisym = gammadxdz_value
1251  = gammadxdz_error = gammadxdz_antisym = gammadydz_value = gammadydz_error = gammadydz_antisym = 0.;
1252  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1253  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1254  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails)
1255  {
1256  gammax_value = fitter->second->value(MuonResiduals6DOFFitter::kResidXGamma);
1257  gammax_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidXGamma);
1258  gammax_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidXGamma);
1259 
1260  gammay_value = fitter->second->value(MuonResiduals6DOFFitter::kResidYGamma);
1261  gammay_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResidYGamma);
1262  gammay_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResidYGamma);
1263 
1264  gammadxdz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeXGamma);
1265  gammadxdz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeXGamma);
1266  gammadxdz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeXGamma);
1267 
1268  gammadydz_value = fitter->second->value(MuonResiduals6DOFFitter::kResSlopeYGamma);
1269  gammadydz_error = fitter->second->errorerror(MuonResiduals6DOFFitter::kResSlopeYGamma);
1270  gammadydz_antisym = fitter->second->antisym(MuonResiduals6DOFFitter::kResSlopeYGamma);
1271  }
1272 
1273  if (writeReport)
1274  {
1275  report << "reports[-1].fittype = \"6DOF\"" << std::endl;
1276  report << "reports[-1].add_parameters(ValErr(" << deltax_value << ", " << deltax_error << ", " << deltax_antisym << "), \\" << std::endl
1277  << " ValErr(" << deltay_value << ", " << deltay_error << ", " << deltay_antisym << "), \\" << std::endl
1278  << " ValErr(" << deltaz_value << ", " << deltaz_error << ", " << deltaz_antisym << "), \\" << std::endl
1279  << " ValErr(" << deltaphix_value << ", " << deltaphix_error << ", " << deltaphix_antisym << "), \\" << std::endl
1280  << " ValErr(" << deltaphiy_value << ", " << deltaphiy_error << ", " << deltaphiy_antisym << "), \\" << std::endl
1281  << " ValErr(" << deltaphiz_value << ", " << deltaphiz_error << ", " << deltaphiz_antisym << "), \\" << std::endl
1282  << " " << loglikelihood << ", " << numsegments << ", " << sumofweights << ", " << redchi2 << ")" << std::endl;
1283  report << "reports[-1].sigmax = ValErr(" << sigmax_value << ", " << sigmax_error << ", " << sigmax_antisym<< ")" << std::endl;
1284  report << "reports[-1].sigmay = ValErr(" << sigmay_value << ", " << sigmay_error << ", " << sigmay_antisym<< ")" << std::endl;
1285  report << "reports[-1].sigmadxdz = ValErr(" << sigmadxdz_value << ", " << sigmadxdz_error << ", "<< sigmadxdz_antisym << ")" << std::endl;
1286  report << "reports[-1].sigmadydz = ValErr(" << sigmadydz_value << ", " << sigmadydz_error << ", "<< sigmadydz_antisym << ")" << std::endl;
1287  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1288  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1289  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails)
1290  {
1291  report << "reports[-1].gammax = ValErr(" << gammax_value << ", " << gammax_error << ", " << gammax_antisym << ")" << std::endl;
1292  report << "reports[-1].gammay = ValErr(" << gammay_value << ", " << gammay_error << ", " << gammay_antisym << ")" << std::endl;
1293  report << "reports[-1].gammadxdz = ValErr(" << gammadxdz_value << ", " << gammadxdz_error << ", " << gammadxdz_antisym << ")" << std::endl;
1294  report << "reports[-1].gammadydz = ValErr(" << gammadydz_value << ", " << gammadydz_error << ", " << gammadydz_antisym << ")" << std::endl;
1295  }
1296 
1297  report << "reports[-1].add_stats("
1298  << fitter->second->median(MuonResiduals6DOFFitter::kResidX) << ", "
1299  << fitter->second->median(MuonResiduals6DOFFitter::kResidY) << ", "
1300  << fitter->second->median(MuonResiduals6DOFFitter::kResSlopeX) << ", "
1301  << fitter->second->median(MuonResiduals6DOFFitter::kResSlopeY) << ", "
1302  << fitter->second->mean(MuonResiduals6DOFFitter::kResidX, 30.) << ", "
1303  << fitter->second->mean(MuonResiduals6DOFFitter::kResidY, 30.) << ", "
1304  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeX, 20.) << ", "
1305  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeY, 50.) << ", "
1306  << fitter->second->mean(MuonResiduals6DOFFitter::kResidX, 15.) << ", "
1307  << fitter->second->mean(MuonResiduals6DOFFitter::kResidY, 15.) << ", "
1308  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeX, 10.) << ", "
1309  << fitter->second->mean(MuonResiduals6DOFFitter::kResSlopeY, 25.) << ", "
1310  << fitter->second->wmean(MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kRedChi2, 30.) << ", "
1311  << fitter->second->wmean(MuonResiduals6DOFFitter::kResidY, MuonResiduals6DOFFitter::kRedChi2, 30.) << ", "
1312  << fitter->second->wmean(MuonResiduals6DOFFitter::kResSlopeX,MuonResiduals6DOFFitter::kRedChi2, 20.) << ", "
1313  << fitter->second->wmean(MuonResiduals6DOFFitter::kResSlopeY, MuonResiduals6DOFFitter::kRedChi2, 50.) << ", "
1314  << fitter->second->wmean(MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kRedChi2, 15.) << ", "
1315  << fitter->second->wmean(MuonResiduals6DOFFitter::kResidY, MuonResiduals6DOFFitter::kRedChi2, 15.) << ", "
1316  << fitter->second->wmean(MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kRedChi2, 10.) << ", "
1317  << fitter->second->wmean(MuonResiduals6DOFFitter::kResSlopeY, MuonResiduals6DOFFitter::kRedChi2, 25.) << ", "
1318  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidX, 30.) << ", "
1319  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidY, 30.) << ", "
1320  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeX, 20.) << ", "
1321  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeY, 50.) << ", "
1322  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidX, 15.) << ", "
1323  << fitter->second->stdev(MuonResiduals6DOFFitter::kResidY, 15.) << ", "
1324  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeX, 10.) << ", "
1325  << fitter->second->stdev(MuonResiduals6DOFFitter::kResSlopeY, 25.) << ")" << std::endl;
1326 
1327  std::stringstream namesimple_x, namesimple_y, namesimple_dxdz, namesimple_dydz, nameweighted_x,
1328  nameweighted_y, nameweighted_dxdz, nameweighted_dydz;
1329  namesimple_x << cname << "_simple_x";
1330  namesimple_y << cname << "_simple_y";
1331  namesimple_dxdz << cname << "_simple_dxdz";
1332  namesimple_dydz << cname << "_simple_dydz";
1333  nameweighted_x << cname << "_weighted_x";
1334  nameweighted_y << cname << "_weighted_y";
1335  nameweighted_dxdz << cname << "_weighted_dxdz";
1336  nameweighted_dydz << cname << "_weighted_dydz";
1337 
1338  fitter->second->plotsimple(namesimple_x.str(), &rootDirectory, MuonResiduals6DOFFitter::kResidX, 10.);
1339  fitter->second->plotsimple(namesimple_y.str(), &rootDirectory, MuonResiduals6DOFFitter::kResidY, 10.);
1340  fitter->second->plotsimple(namesimple_dxdz.str(), &rootDirectory, MuonResiduals6DOFFitter::kResSlopeX, 1000.);
1341  fitter->second->plotsimple(namesimple_dydz.str(), &rootDirectory, MuonResiduals6DOFFitter::kResSlopeY,1000.);
1342 
1343  fitter->second->plotweighted(nameweighted_x.str(), &rootDirectory, MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kRedChi2, 10.);
1344  fitter->second->plotweighted(nameweighted_y.str(), &rootDirectory, MuonResiduals6DOFFitter::kResidY, MuonResiduals6DOFFitter::kRedChi2, 10.);
1345  fitter->second->plotweighted(nameweighted_dxdz.str(), &rootDirectory, MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kRedChi2, 1000.);
1346  fitter->second->plotweighted(nameweighted_dydz.str(), &rootDirectory, MuonResiduals6DOFFitter::kResSlopeY, MuonResiduals6DOFFitter::kRedChi2, 1000.);
1347  }
1348 
1349  if (successful_fit)
1350  {
1351  if (align_x) params[paramIndex[0]] = deltax_value;
1352  if (align_y) params[paramIndex[1]] = deltay_value;
1353  if (align_z) params[paramIndex[2]] = deltaz_value;
1354  if (align_phix) params[paramIndex[3]] = deltaphix_value;
1355  if (align_phiy) params[paramIndex[4]] = deltaphiy_value;
1356  if (align_phiz) params[paramIndex[5]] = deltaphiz_value;
1357  }
1358  } // end if 6DOF
1359 
1360  else if (fitter->second->type() == MuonResidualsFitter::k6DOFrphi)
1361  {
1362  double deltax_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignX);
1363  double deltax_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignX);
1364  double deltax_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignX);
1365 
1366  double deltay_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignY);
1367  double deltay_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignY);
1368  double deltay_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignY);
1369 
1370  double deltaz_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignZ);
1371  double deltaz_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignZ);
1372  double deltaz_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignZ);
1373 
1374  double deltaphix_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1375  double deltaphix_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1376  double deltaphix_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignPhiX);
1377 
1378  double deltaphiy_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1379  double deltaphiy_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1380  double deltaphiy_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignPhiY);
1381 
1382  double deltaphiz_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1383  double deltaphiz_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1384  double deltaphiz_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kAlignPhiZ);
1385 
1386  double sigmaresid_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResidSigma);
1387  double sigmaresid_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResidSigma);
1388  double sigmaresid_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResidSigma);
1389 
1390  double sigmaresslope_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResSlopeSigma);
1391  double sigmaresslope_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResSlopeSigma);
1392  double sigmaresslope_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResSlopeSigma);
1393 
1394  double gammaresid_value, gammaresid_error, gammaresid_antisym, gammaresslope_value, gammaresslope_error, gammaresslope_antisym;
1395  gammaresid_value = gammaresid_error = gammaresid_antisym = gammaresslope_value = gammaresslope_error = gammaresslope_antisym = 0.;
1396  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1397  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1398  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails)
1399  {
1400  gammaresid_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResidGamma);
1401  gammaresid_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResidGamma);
1402  gammaresid_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResidGamma);
1403 
1404  gammaresslope_value = fitter->second->value(MuonResiduals6DOFrphiFitter::kResSlopeGamma);
1405  gammaresslope_error = fitter->second->errorerror(MuonResiduals6DOFrphiFitter::kResSlopeGamma);
1406  gammaresslope_antisym = fitter->second->antisym(MuonResiduals6DOFrphiFitter::kResSlopeGamma);
1407  }
1408 
1409  if (writeReport)
1410  {
1411  report << "reports[-1].fittype = \"6DOFrphi\"" << std::endl;
1412  report << "reports[-1].add_parameters(ValErr(" << deltax_value << ", " << deltax_error << ", " << deltax_antisym << "), \\" << std::endl
1413  << " ValErr(" << deltay_value << ", " << deltay_error << ", " << deltay_antisym << "), \\" << std::endl
1414  << " ValErr(" << deltaz_value << ", " << deltaz_error << ", " << deltaz_antisym << "), \\" << std::endl
1415  << " ValErr(" << deltaphix_value << ", " << deltaphix_error << ", " << deltaphix_antisym << "), \\" << std::endl
1416  << " ValErr(" << deltaphiy_value << ", " << deltaphiy_error << ", " << deltaphiy_antisym << "), \\" << std::endl
1417  << " ValErr(" << deltaphiz_value << ", " << deltaphiz_error << ", " << deltaphiz_antisym << "), \\" << std::endl
1418  << " " << loglikelihood << ", " << numsegments << ", " << sumofweights << ", " << redchi2 << ")" << std::endl;
1419  report << "reports[-1].sigmaresid = ValErr(" << sigmaresid_value << ", " << sigmaresid_error << ", " << sigmaresid_antisym << ")" << std::endl;
1420  report << "reports[-1].sigmaresslope = ValErr(" << sigmaresslope_value << ", " << sigmaresslope_error << ", " << sigmaresslope_antisym << ")" << std::endl;
1421  if (fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian &&
1422  fitter->second->residualsModel() != MuonResidualsFitter::kPureGaussian2D &&
1423  fitter->second->residualsModel() != MuonResidualsFitter::kGaussPowerTails)
1424  {
1425  report << "reports[-1].gammaresid = ValErr(" << gammaresid_value << ", " << gammaresid_error << ", " << gammaresid_antisym << ")" << std::endl;
1426  report << "reports[-1].gammaresslope = ValErr(" << gammaresslope_value << ", " << gammaresslope_error << ", " << gammaresslope_antisym << ")" << std::endl;
1427  }
1428 
1429  report << "reports[-1].add_stats(" << fitter->second->median(MuonResiduals6DOFrphiFitter::kResid) << ", " << "None, "
1430  << fitter->second->median(MuonResiduals6DOFrphiFitter::kResSlope) << ", " << "None, "
1431  << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResid, 30.) << ", " << "None, "
1432  << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResSlope, 20.) << ", " << "None, "
1433  << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResid, 15.) << ", " << "None, "
1434  << fitter->second->mean(MuonResiduals6DOFrphiFitter::kResSlope, 10.) << ", " << "None, "
1435  << fitter->second->wmean(MuonResiduals6DOFrphiFitter::kResid, MuonResiduals6DOFrphiFitter::kRedChi2, 30.) << ", " << "None, "
1436  << fitter->second->wmean(MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals6DOFrphiFitter::kRedChi2, 20.) << ", " << "None, "
1437  << fitter->second->wmean(MuonResiduals6DOFrphiFitter::kResid, MuonResiduals6DOFrphiFitter::kRedChi2, 15.) << ", " << "None, "
1438  << fitter->second->wmean(MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals6DOFrphiFitter::kRedChi2, 10.) << ", " << "None, "
1439  << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResid, 30.) << ", " << "None, "
1440  << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResSlope, 20.) << ", " << "None, "
1441  << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResid, 15.) << ", " << "None, "
1442  << fitter->second->stdev(MuonResiduals6DOFrphiFitter::kResSlope, 10.) << ", " << "None)" << std::endl;
1443 
1444  std::stringstream namesimple_x, namesimple_dxdz, nameweighted_x, nameweighted_dxdz;
1445  namesimple_x << cname << "_simple_x";
1446  namesimple_dxdz << cname << "_simple_dxdz";
1447  nameweighted_x << cname << "_weighted_x";
1448  nameweighted_dxdz << cname << "_weighted_dxdz";
1449 
1450  fitter->second->plotsimple(namesimple_x.str(), &rootDirectory, MuonResiduals6DOFrphiFitter::kResid, 10.);
1451  fitter->second->plotsimple(namesimple_dxdz.str(), &rootDirectory, MuonResiduals6DOFrphiFitter::kResSlope, 1000.);
1452 
1453  fitter->second->plotweighted(nameweighted_x.str(), &rootDirectory, MuonResiduals6DOFrphiFitter::kResid, MuonResiduals6DOFrphiFitter::kRedChi2, 10.);
1454  fitter->second->plotweighted(nameweighted_dxdz.str(), &rootDirectory, MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals6DOFrphiFitter::kRedChi2, 1000.);
1455  }
1456 
1457  if (successful_fit)
1458  {
1459  if (align_x) params[paramIndex[0]] = deltax_value;
1460  if (align_y) params[paramIndex[1]] = deltay_value;
1461  if (align_z) params[paramIndex[2]] = deltaz_value;
1462  if (align_phix) params[paramIndex[3]] = deltaphix_value;
1463  if (align_phiy) params[paramIndex[4]] = deltaphiy_value;
1464  if (align_phiz) params[paramIndex[5]] = deltaphiz_value;
1465  }
1466  } // end if 6DOFrphi
1467 
1468  if (successful_fit)
1469  {
1470  std::vector<Alignable*> oneortwo;
1471  oneortwo.push_back(*ali);
1472  if (thisali != *ali) oneortwo.push_back(thisali);
1474  }
1475  else
1476  {
1477  std::cout << "MINUIT fit failed!" << std::endl;
1478  if (writeReport)
1479  {
1480  report << "reports[-1].status = \"MINUITFAIL\"" << std::endl;
1481  }
1482 
1483  for (int i = 0; i < numParams; i++) cov[i][i] = 1000.;
1484 
1485  std::vector<Alignable*> oneortwo;
1486  oneortwo.push_back(*ali);
1487  if (thisali != *ali) oneortwo.push_back(thisali);
1489  }
1490  }
1491  else
1492  { // too few hits
1493  std::cout << "Too few hits!" << std::endl;
1494  if (writeReport)
1495  {
1496  report << "reports[-1].status = \"TOOFEWHITS\"" << std::endl;
1497  }
1498 
1499  for (int i = 0; i < numParams; i++) cov[i][i] = 1000.;
1500 
1501  std::vector<Alignable*> oneortwo;
1502  oneortwo.push_back(*ali);
1503  if (thisali != *ali) oneortwo.push_back(thisali);
1505  }
1506 
1507  AlignmentParameters *parnew = (*ali)->alignmentParameters()->cloneFromSelected(params, cov);
1508  (*ali)->setAlignmentParameters(parnew);
1510  (*ali)->alignmentParameters()->setValid(true);
1511 
1512  std::cout << cname<<" fittime= "<< stop_watch.CpuTime() << " sec" << std::endl;
1513  } // end we have a fitter for this alignable
1514 
1515  if (writeReport) report << std::endl;
1516 
1517  } // end loop over alignables
1518 
1519  if (writeReport) report.close();
1520 }
int i
Definition: DBlmapReader.cc:9
void setAlignmentPositionError(const align::Alignables &alivec, double valshift, double valrot)
Set Alignment position error.
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
AlignmentParameterStore * m_alignmentParameterStore
tuple report
Definition: zeeHLT_cff.py:9
static const int CSC
Definition: MuonSubdetId.h:13
Definition: DetId.h:18
CLHEP::HepVector AlgebraicVector
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
std::map< Alignable *, Alignable * > m_me11map
CLHEP::HepSymMatrix AlgebraicSymMatrix
tuple cout
Definition: gather_cfg.py:121
static const int DT
Definition: MuonSubdetId.h:12
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
std::vector< Alignable * > m_alignables
std::map< Alignable *, MuonResidualsTwoBin * > m_fitters
void MuonAlignmentFromReference::initialize ( const edm::EventSetup setup,
AlignableTracker tracker,
AlignableMuon muon,
AlignableExtras extras,
AlignmentParameterStore store 
)
overridevirtual

Call at beginning of job (must be implemented in derived class)

Implements AlignmentAlgorithmBase.

Definition at line 300 of file MuonAlignmentFromReference.cc.

References align::AlignableCSCChamber, align::AlignableDTChamber, AlignmentParameterStore::alignables(), AlignableMuon::CSCChambers(), AlignableMuon::DTChambers(), Reference_intrackfit_cff::endcap, edm::hlt::Exception, edm::EventSetup::get(), cmsHarvester::index, MuonResidualsFitter::k0010, MuonResidualsFitter::k1010, MuonResidualsFitter::k1100, MuonResidualsFitter::k1110, MuonResidualsFitter::k1111, MuonResidualsFitter::kGaussPowerTails, MuonResidualsFitter::kPowerLawTails, MuonResidualsFitter::kPureGaussian, MuonResidualsFitter::kPureGaussian2D, MuonResidualsFitter::kROOTVoigt, m_alignableNavigator, m_alignables, m_alignmentParameterStore, m_combineME11, m_fitterOrder, m_fitters, m_indexes, m_me11map, m_minAlignmentHits, m_reference, m_residualsModel, m_strategy, m_twoBin, m_useResiduals, m_weightAlignment, NULL, parseReference(), DetId::rawId(), RecoTauValidation_cfi::reference, align_cfg::residualsModel, AlignmentParameterStore::setAlignmentPositionError(), python.multivaluedict::sort(), relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, and align_cfg::useResiduals.

305 {
306  if (alignableMuon == NULL)
307  throw cms::Exception("MuonAlignmentFromReference") << "doMuon must be set to True" << std::endl;
308 
309  m_alignableNavigator = new AlignableNavigator(alignableMuon);
310  m_alignmentParameterStore = alignmentParameterStore;
312 
313  int residualsModel;
314  if (m_residualsModel == std::string("pureGaussian")) residualsModel = MuonResidualsFitter::kPureGaussian;
315  else if (m_residualsModel == std::string("pureGaussian2D")) residualsModel = MuonResidualsFitter::kPureGaussian2D;
316  else if (m_residualsModel == std::string("powerLawTails")) residualsModel = MuonResidualsFitter::kPowerLawTails;
317  else if (m_residualsModel == std::string("ROOTVoigt")) residualsModel = MuonResidualsFitter::kROOTVoigt;
318  else if (m_residualsModel == std::string("GaussPowerTails")) residualsModel = MuonResidualsFitter::kGaussPowerTails;
319  else throw cms::Exception("MuonAlignmentFromReference") << "unrecognized residualsModel: \"" << m_residualsModel << "\"" << std::endl;
320 
321  int useResiduals;
322  if (m_useResiduals == std::string("1111")) useResiduals = MuonResidualsFitter::k1111;
323  else if (m_useResiduals == std::string("1110")) useResiduals = MuonResidualsFitter::k1110;
324  else if (m_useResiduals == std::string("1100")) useResiduals = MuonResidualsFitter::k1100;
325  else if (m_useResiduals == std::string("1010")) useResiduals = MuonResidualsFitter::k1010;
326  else if (m_useResiduals == std::string("0010")) useResiduals = MuonResidualsFitter::k0010;
327  else throw cms::Exception("MuonAlignmentFromReference") << "unrecognized useResiduals: \"" << m_useResiduals << "\"" << std::endl;
328 
329  edm::ESHandle<CSCGeometry> cscGeometry;
330  iSetup.get<MuonGeometryRecord>().get(cscGeometry);
331 
332  // set up the MuonResidualsFitters (which also collect residuals for fitting)
333  m_me11map.clear();
334  m_fitters.clear();
335  m_indexes.clear();
336  m_fitterOrder.clear();
337 
338  for (std::vector<Alignable*>::const_iterator ali = m_alignables.begin(); ali != m_alignables.end(); ++ali)
339  {
340  bool made_fitter = false;
341 
342  // fitters for DT
343  if ((*ali)->alignableObjectId() == align::AlignableDTChamber)
344  {
345  DTChamberId id( (*ali)->geomDetId().rawId() );
346 
347  if (id.station() == 4)
348  {
349  m_fitters[*ali] =
351  new MuonResiduals5DOFFitter(residualsModel, m_minAlignmentHits, useResiduals, m_weightAlignment));
352  made_fitter = true;
353  }
354  else
355  {
356  m_fitters[*ali] =
358  new MuonResiduals6DOFFitter(residualsModel, m_minAlignmentHits, useResiduals, m_weightAlignment));
359  made_fitter = true;
360  }
361  }
362 
363  // fitters for CSC
364  else if ((*ali)->alignableObjectId() == align::AlignableCSCChamber)
365  {
366  Alignable *thisali = *ali;
367  CSCDetId id( (*ali)->geomDetId().rawId() );
368 
369  // take care of ME1/1a
370  if (m_combineME11 && id.station() == 1 && id.ring() == 4)
371  {
372  CSCDetId pairid(id.endcap(), 1, 1, id.chamber());
373 
374  for (std::vector<Alignable*>::const_iterator ali2 = m_alignables.begin(); ali2 != m_alignables.end(); ++ali2)
375  {
376  if ((*ali2)->alignableObjectId() == align::AlignableCSCChamber && (*ali2)->geomDetId().rawId() == pairid.rawId())
377  {
378  thisali = *ali2;
379  break;
380  }
381  }
382  m_me11map[*ali] = thisali; // points from each ME1/4 chamber to the corresponding ME1/1 chamber
383  }
384 
385  if (thisali == *ali) // don't make fitters for ME1/4; they get taken care of in ME1/1
386  {
387  m_fitters[*ali] =
388  new MuonResidualsTwoBin(m_twoBin, new MuonResiduals6DOFrphiFitter(residualsModel, m_minAlignmentHits, useResiduals, &(*cscGeometry), m_weightAlignment),
389  new MuonResiduals6DOFrphiFitter(residualsModel, m_minAlignmentHits, useResiduals, &(*cscGeometry), m_weightAlignment));
390  made_fitter = true;
391  }
392  }
393 
394  else {
395  throw cms::Exception("MuonAlignmentFromReference") << "only DTChambers and CSCChambers can be aligned with this module" << std::endl;
396  }
397 
398  if (made_fitter) {
399  m_fitters[*ali]->setStrategy(m_strategy);
400 
401  int index = (*ali)->geomDetId().rawId();
402  m_indexes.push_back(index);
403  m_fitterOrder[index] = m_fitters[*ali];
404  }
405  } // end loop over chambers chosen for alignment
406 
407  // cannonical order of fitters in the file
408  std::sort(m_indexes.begin(), m_indexes.end());
409 
410  // de-weight all chambers but the reference
411  std::vector<Alignable*> all_DT_chambers = alignableMuon->DTChambers();
412  std::vector<Alignable*> all_CSC_chambers = alignableMuon->CSCChambers();
413  std::vector<Alignable*> reference;
414  if (m_reference.size()) parseReference(reference, all_DT_chambers, all_CSC_chambers);
415 
416  alignmentParameterStore->setAlignmentPositionError(all_DT_chambers, 100000000., 0.);
417  alignmentParameterStore->setAlignmentPositionError(all_CSC_chambers, 100000000., 0.);
418  alignmentParameterStore->setAlignmentPositionError(reference, 0., 0.);
419 }
#define NULL
Definition: scimark2.h:8
AlignmentParameterStore * m_alignmentParameterStore
list residualsModel
Definition: align_cfg.py:34
std::vector< unsigned int > m_indexes
void parseReference(std::vector< Alignable * > &reference, std::vector< Alignable * > &all_DT_chambers, std::vector< Alignable * > &all_CSC_chambers)
std::vector< std::string > m_reference
list useResiduals
Definition: align_cfg.py:36
std::map< Alignable *, Alignable * > m_me11map
const align::Alignables & alignables(void) const
get all alignables
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
std::vector< Alignable * > m_alignables
std::map< Alignable *, MuonResidualsTwoBin * > m_fitters
int MuonAlignmentFromReference::number ( std::string  s)
private

Definition at line 293 of file MuonAlignmentFromReference.cc.

References numeric().

Referenced by parseReference().

294 {
295  if (!numeric(s)) assert(false);
296  return atoi(s.c_str());
297 }
bool MuonAlignmentFromReference::numeric ( std::string  s)
private

Definition at line 287 of file MuonAlignmentFromReference.cc.

Referenced by number(), and parseReference().

288 {
289  return s.length()==1 && std::isdigit(s[0]);
290 }
void MuonAlignmentFromReference::parseReference ( std::vector< Alignable * > &  reference,
std::vector< Alignable * > &  all_DT_chambers,
std::vector< Alignable * > &  all_CSC_chambers 
)
private

Definition at line 422 of file MuonAlignmentFromReference.cc.

References funct::abs(), Reference_intrackfit_cff::barrel, Reference_intrackfit_cff::endcap, edm::hlt::Exception, cmsHarvester::index, m_reference, mergeVDriftHistosByStation::name, number(), numeric(), reco::HaloData::plus, relativeConstraints::ring, relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by initialize().

426 {
427  std::map<Alignable*,bool> already_seen;
428 
429  for (std::vector<std::string>::const_iterator name = m_reference.begin(); name != m_reference.end(); ++name)
430  {
431  bool parsing_error = false;
432 
433  bool barrel = (name->substr(0, 2) == std::string("MB"));
434  bool endcap = (name->substr(0, 2) == std::string("ME"));
435  if (!barrel && !endcap) parsing_error = true;
436 
437  if (!parsing_error && barrel)
438  {
439  int index = 2;
440  if (name->substr(index, 1) == std::string(" ")) index++;
441 
442  bool plus = true;
443  if (name->substr(index, 1) == std::string("+"))
444  {
445  plus = true;
446  index++;
447  }
448  else if (name->substr(index, 1) == std::string("-"))
449  {
450  plus = false;
451  index++;
452  }
453  else if (numeric(name->substr(index, 1))) {}
454  else parsing_error = true;
455 
456  int wheel = 0;
457  bool wheel_digit = false;
458  while (!parsing_error && numeric(name->substr(index, 1)))
459  {
460  wheel *= 10;
461  wheel += number(name->substr(index, 1));
462  wheel_digit = true;
463  index++;
464  }
465  if (!plus) wheel *= -1;
466  if (!wheel_digit) parsing_error = true;
467 
468  if (name->substr(index, 1) != std::string(" ")) parsing_error = true;
469  index++;
470 
471  int station = 0;
472  bool station_digit = false;
473  while (!parsing_error && numeric(name->substr(index, 1)))
474  {
475  station *= 10;
476  station += number(name->substr(index, 1));
477  station_digit = true;
478  index++;
479  }
480  if (!station_digit) parsing_error = true;
481 
482  if (name->substr(index, 1) != std::string(" ")) parsing_error = true;
483  index++;
484 
485  int sector = 0;
486  bool sector_digit = false;
487  while (!parsing_error && numeric(name->substr(index, 1)))
488  {
489  sector *= 10;
490  sector += number(name->substr(index, 1));
491  sector_digit = true;
492  index++;
493  }
494  if (!sector_digit) parsing_error = true;
495 
496  if (!parsing_error)
497  {
498  bool no_such_chamber = false;
499 
500  if (wheel < -2 || wheel > 2) no_such_chamber = true;
501  if (station < 1 || station > 4) no_such_chamber = true;
502  if (station == 4 && (sector < 1 || sector > 14)) no_such_chamber = true;
503  if (station < 4 && (sector < 1 || sector > 12)) no_such_chamber = true;
504 
505  if (no_such_chamber)
506  throw cms::Exception("MuonAlignmentFromReference") << "reference chamber doesn't exist: " << (*name) << std::endl;
507 
508  DTChamberId id(wheel, station, sector);
509  for (std::vector<Alignable*>::const_iterator ali = all_DT_chambers.begin(); ali != all_DT_chambers.end(); ++ali)
510  {
511  if ((*ali)->geomDetId().rawId() == id.rawId())
512  {
513  std::map<Alignable*,bool>::const_iterator trial = already_seen.find(*ali);
514  if (trial == already_seen.end())
515  {
516  reference.push_back(*ali);
517  already_seen[*ali] = true;
518  }
519  }
520  }
521  } // if (!parsing_error)
522  }
523 
524  if (!parsing_error && endcap)
525  {
526  int index = 2;
527  if (name->substr(index, 1) == std::string(" ")) index++;
528 
529  bool plus = true;
530  if (name->substr(index, 1) == std::string("+"))
531  {
532  plus = true;
533  index++;
534  }
535  else if (name->substr(index, 1) == std::string("-"))
536  {
537  plus = false;
538  index++;
539  }
540  else if (numeric(name->substr(index, 1))) {}
541  else parsing_error = true;
542 
543  int station = 0;
544  bool station_digit = false;
545  while (!parsing_error && numeric(name->substr(index, 1)))
546  {
547  station *= 10;
548  station += number(name->substr(index, 1));
549  station_digit = true;
550  index++;
551  }
552  if (!plus) station *= -1;
553  if (!station_digit) parsing_error = true;
554 
555  if (name->substr(index, 1) != std::string("/")) parsing_error = true;
556  index++;
557 
558  int ring = 0;
559  bool ring_digit = false;
560  while (!parsing_error && numeric(name->substr(index, 1)))
561  {
562  ring *= 10;
563  ring += number(name->substr(index, 1));
564  ring_digit = true;
565  index++;
566  }
567  if (!ring_digit) parsing_error = true;
568 
569  if (name->substr(index, 1) != std::string(" ")) parsing_error = true;
570  index++;
571 
572  int chamber = 0;
573  bool chamber_digit = false;
574  while (!parsing_error && numeric(name->substr(index, 1)))
575  {
576  chamber *= 10;
577  chamber += number(name->substr(index, 1));
578  chamber_digit = true;
579  index++;
580  }
581  if (!chamber_digit) parsing_error = true;
582 
583  if (!parsing_error)
584  {
585  bool no_such_chamber = false;
586 
587  int endcap = (station > 0 ? 1 : 2);
588  station = abs(station);
589  if (station < 1 || station > 4) no_such_chamber = true;
590  if (station == 1 && (ring < 1 || ring > 4)) no_such_chamber = true;
591  if (station > 1 && (ring < 1 || ring > 2)) no_such_chamber = true;
592  if (station == 1 && (chamber < 1 || chamber > 36)) no_such_chamber = true;
593  if (station > 1 && ring == 1 && (chamber < 1 || chamber > 18)) no_such_chamber = true;
594  if (station > 1 && ring == 2 && (chamber < 1 || chamber > 36)) no_such_chamber = true;
595 
596  if (no_such_chamber)
597  throw cms::Exception("MuonAlignmentFromReference") << "reference chamber doesn't exist: " << (*name) << std::endl;
598 
599  CSCDetId id(endcap, station, ring, chamber);
600  for (std::vector<Alignable*>::const_iterator ali = all_CSC_chambers.begin(); ali != all_CSC_chambers.end(); ++ali)
601  {
602  if ((*ali)->geomDetId().rawId() == id.rawId())
603  {
604  std::map<Alignable*,bool>::const_iterator trial = already_seen.find(*ali);
605  if (trial == already_seen.end())
606  {
607  reference.push_back(*ali);
608  already_seen[*ali] = true;
609  }
610  }
611  }
612  } // if (!parsing_error)
613  }// endcap
614 
615  if (parsing_error)
616  throw cms::Exception("MuonAlignmentFromReference") << "reference chamber name is malformed: " << (*name) << std::endl;
617  }
618 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< std::string > m_reference
void MuonAlignmentFromReference::processMuonResidualsFromTrack ( MuonResidualsFromTrack mrft)

Definition at line 686 of file MuonAlignmentFromReference.cc.

References MuonChamberResidual::chamberAlignable(), MuonResidualsFromTrack::chamberIds(), MuonResidualsFromTrack::chamberResidual(), DeDxDiscriminatorTools::charge(), reco::TrackBase::charge(), MuonChamberResidual::chi2(), MuonResidualsFromTrack::contains_TIDTEC(), MuonSubdetId::CSC, MuonSubdetId::DT, DTChamberId, Alignable::geomDetId(), MuonResidualsFromTrack::getTrack(), MuonResiduals5DOFFitter::kAngleX, MuonResiduals6DOFrphiFitter::kAngleX, MuonResiduals6DOFFitter::kAngleX, MuonResiduals5DOFFitter::kAngleY, MuonResiduals6DOFrphiFitter::kAngleY, MuonResiduals6DOFFitter::kAngleY, MuonResiduals5DOFFitter::kCharge, MuonResiduals6DOFrphiFitter::kCharge, MuonResiduals6DOFFitter::kCharge, MuonChamberResidual::kCSC, MuonChamberResidual::kDT13, MuonChamberResidual::kDT2, MuonResiduals5DOFFitter::kNData, MuonResiduals6DOFrphiFitter::kNData, MuonResiduals6DOFFitter::kNData, MuonResiduals5DOFFitter::kPositionX, MuonResiduals6DOFrphiFitter::kPositionX, MuonResiduals6DOFFitter::kPositionX, MuonResiduals5DOFFitter::kPositionY, MuonResiduals6DOFrphiFitter::kPositionY, MuonResiduals6DOFFitter::kPositionY, MuonResiduals5DOFFitter::kPt, MuonResiduals6DOFrphiFitter::kPt, MuonResiduals6DOFFitter::kPt, MuonResiduals5DOFFitter::kPz, MuonResiduals6DOFrphiFitter::kPz, MuonResiduals6DOFFitter::kPz, MuonResiduals5DOFFitter::kRedChi2, MuonResiduals6DOFrphiFitter::kRedChi2, MuonResiduals6DOFFitter::kRedChi2, MuonResiduals5DOFFitter::kResid, MuonResiduals6DOFrphiFitter::kResid, MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kResidY, MuonResiduals5DOFFitter::kResSlope, MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kResSlopeY, m_allowTIDTEC, m_combineME11, m_counter_csc, m_counter_cscaligning, m_counter_cschits, m_counter_cscvalid, m_counter_minchambers, m_counter_resslopey, m_counter_station123, m_counter_station123aligning, m_counter_station123dt13hits, m_counter_station123dt2hits, m_counter_station123valid, m_counter_station4, m_counter_station4aligning, m_counter_station4hits, m_counter_station4valid, m_counter_totchambers, m_counter_trackerchi2, m_counter_trackerhits, m_counter_trackertidtec, m_doCSC, m_doDT, m_fitters, m_maxResSlopeY, m_maxTrackerRedChi2, m_me11map, m_minCSCHits, m_minDT13Hits, m_minDT2Hits, m_minNCrossedChambers, m_minTrackerHits, DetId::Muon, MuonChamberResidual::ndof(), MuonResidualsFromTrack::normalizedChi2(), NULL, MuonChamberResidual::numHits(), reco::TrackBase::pt(), reco::TrackBase::pz(), DetId::rawId(), MuonChamberResidual::residual(), MuonChamberResidual::resslope(), relativeConstraints::station, MuonChamberResidual::trackdxdz(), MuonChamberResidual::trackdydz(), MuonResidualsFromTrack::trackerNumHits(), MuonChamberResidual::trackx(), and MuonChamberResidual::tracky().

Referenced by run().

687 {
688  if (mrft.trackerNumHits() >= m_minTrackerHits)
689  {
691  if (mrft.normalizedChi2() < m_maxTrackerRedChi2)
692  {
694  if (m_allowTIDTEC || !mrft.contains_TIDTEC())
695  {
697 
698  std::vector<DetId> chamberIds = mrft.chamberIds();
699 
700  if ((int)chamberIds.size() >= m_minNCrossedChambers)
701  {
703 
704  char charge = (mrft.getTrack()->charge() > 0 ? 1 : -1);
705 
706  for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end(); ++chamberId)
707  {
708  if (chamberId->det() != DetId::Muon) continue;
710 
711  // DT station 1,2,3
712  if (m_doDT &&
713  chamberId->subdetId() == MuonSubdetId::DT &&
714  DTChamberId(chamberId->rawId()).station() != 4)
715  {
718 
720  if (dt13 != NULL && dt2 != NULL)
721  {
723  if (dt13->numHits() >= m_minDT13Hits)
724  {
726  if (dt2->numHits() >= m_minDT2Hits)
727  {
729  std::map<Alignable*,MuonResidualsTwoBin*>::const_iterator fitter = m_fitters.find(dt13->chamberAlignable());
730  if (fitter != m_fitters.end())
731  {
733  if (fabs(dt2->resslope()) < m_maxResSlopeY)
734  {
736  double *residdata = new double[MuonResiduals6DOFFitter::kNData];
737  residdata[MuonResiduals6DOFFitter::kResidX] = dt13->residual();
738  residdata[MuonResiduals6DOFFitter::kResidY] = dt2->residual();
739  residdata[MuonResiduals6DOFFitter::kResSlopeX] = dt13->resslope();
740  residdata[MuonResiduals6DOFFitter::kResSlopeY] = dt2->resslope();
741  residdata[MuonResiduals6DOFFitter::kPositionX] = dt13->trackx();
742  residdata[MuonResiduals6DOFFitter::kPositionY] = dt13->tracky();
743  residdata[MuonResiduals6DOFFitter::kAngleX] = dt13->trackdxdz();
744  residdata[MuonResiduals6DOFFitter::kAngleY] = dt13->trackdydz();
745  residdata[MuonResiduals6DOFFitter::kRedChi2] = (dt13->chi2() + dt2->chi2()) / double(dt13->ndof() + dt2->ndof());
746  residdata[MuonResiduals6DOFFitter::kPz] = mrft.getTrack()->pz();
747  residdata[MuonResiduals6DOFFitter::kPt] = mrft.getTrack()->pt();
748  residdata[MuonResiduals6DOFFitter::kCharge] = mrft.getTrack()->charge();
749  fitter->second->fill(charge, residdata);
750  // the MuonResidualsFitter will delete the array when it is destroyed
751  }
752  }
753  }
754  }
755  }
756  }
757 
758  // DT 4th station
759  else if (m_doDT &&
760  chamberId->subdetId() == MuonSubdetId::DT &&
761  DTChamberId(chamberId->rawId()).station() == 4)
762  {
764 
766  if (dt13 != NULL)
767  {
769  if (dt13->numHits() >= m_minDT13Hits)
770  {
772 
773  std::map<Alignable*,MuonResidualsTwoBin*>::const_iterator fitter = m_fitters.find(dt13->chamberAlignable());
774  if (fitter != m_fitters.end())
775  {
777 
778  double *residdata = new double[MuonResiduals5DOFFitter::kNData];
779  residdata[MuonResiduals5DOFFitter::kResid] = dt13->residual();
780  residdata[MuonResiduals5DOFFitter::kResSlope] = dt13->resslope();
781  residdata[MuonResiduals5DOFFitter::kPositionX] = dt13->trackx();
782  residdata[MuonResiduals5DOFFitter::kPositionY] = dt13->tracky();
783  residdata[MuonResiduals5DOFFitter::kAngleX] = dt13->trackdxdz();
784  residdata[MuonResiduals5DOFFitter::kAngleY] = dt13->trackdydz();
785  residdata[MuonResiduals5DOFFitter::kRedChi2] = dt13->chi2() / double(dt13->ndof());
786  residdata[MuonResiduals5DOFFitter::kPz] = mrft.getTrack()->pz();
787  residdata[MuonResiduals5DOFFitter::kPt] = mrft.getTrack()->pt();
788  residdata[MuonResiduals5DOFFitter::kCharge] = mrft.getTrack()->charge();
789  fitter->second->fill(charge, residdata);
790  // the MuonResidualsFitter will delete the array when it is destroyed
791  }
792  }
793  }
794  } // end DT 4th station
795 
796  // CSC
797  else if (m_doCSC &&
798  chamberId->subdetId() == MuonSubdetId::CSC)
799  {
801  m_counter_csc++;
802  if (csc != NULL)
803  {
805  if (csc->numHits() >= m_minCSCHits)
806  {
808  Alignable *ali = csc->chamberAlignable();
809 
810  CSCDetId id(ali->geomDetId().rawId());
811  if (m_combineME11 && id.station() == 1 && id.ring() == 4) ali = m_me11map[ali];
812 
813  std::map<Alignable*,MuonResidualsTwoBin*>::const_iterator fitter = m_fitters.find(ali);
814  if (fitter != m_fitters.end())
815  {
817  double *residdata = new double[MuonResiduals6DOFrphiFitter::kNData];
818  residdata[MuonResiduals6DOFrphiFitter::kResid] = csc->residual();
824  residdata[MuonResiduals6DOFrphiFitter::kRedChi2] = csc->chi2() / double(csc->ndof());
825  residdata[MuonResiduals6DOFrphiFitter::kPz] = mrft.getTrack()->pz();
826  residdata[MuonResiduals6DOFrphiFitter::kPt] = mrft.getTrack()->pt();
828  fitter->second->fill(charge, residdata);
829  // the MuonResidualsFitter will delete the array when it is destroyed
830  }
831  }
832  }
833  } // end CSC
834 
835  else if (m_doDT && m_doCSC) assert(false);
836 
837  } // end loop over chamberIds
838  } // # crossed muon chambers ok
839  } // endcap tracker ok
840  } // chi2 ok
841  } // trackerNumHits ok
842 }
#define NULL
Definition: scimark2.h:8
double charge(const std::vector< uint8_t > &Ampls)
double trackx() const
const std::vector< DetId > chamberIds() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
double resslope() const
double trackdxdz() const
static const int CSC
Definition: MuonSubdetId.h:13
double pt() const
track transverse momentum
Definition: TrackBase.h:129
const reco::Track * getTrack()
AlignableDetOrUnitPtr chamberAlignable() const
double tracky() const
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:135
double trackdydz() const
std::map< Alignable *, Alignable * > m_me11map
int charge() const
track electric charge
Definition: TrackBase.h:111
static const int DT
Definition: MuonSubdetId.h:12
double residual() const
const DetId & geomDetId() const
Definition: Alignable.h:177
std::map< Alignable *, MuonResidualsTwoBin * > m_fitters
MuonChamberResidual * chamberResidual(DetId chamberId, int type)
void MuonAlignmentFromReference::readTmpFiles ( )
private

Definition at line 1523 of file MuonAlignmentFromReference.cc.

References edm::hlt::Exception, mergeVDriftHistosByStation::file, convertXMLtoSQLite_cfg::fileName, i, cmsHarvester::index, m_fitterOrder, m_indexes, m_readTemporaryFiles, NULL, MuonResidualsTwoBin::read(), and findQualityFiles::size.

Referenced by terminate().

1524 {
1525  for (std::vector<std::string>::const_iterator fileName = m_readTemporaryFiles.begin(); fileName != m_readTemporaryFiles.end(); ++fileName)
1526  {
1527  FILE *file;
1528  int size;
1529  file = fopen(fileName->c_str(), "r");
1530  if (file == NULL)
1531  throw cms::Exception("MuonAlignmentFromReference") << "file \"" << *fileName << " can't be opened (doesn't exist?)" << std::endl;
1532 
1533  fread(&size, sizeof(int), 1, file);
1534  if (int(m_indexes.size()) != size)
1535  throw cms::Exception("MuonAlignmentFromReference") << "file \"" << *fileName << "\" has " << size
1536  << " fitters, but this job has " << m_indexes.size() << " fitters (probably corresponds to the wrong alignment job)" << std::endl;
1537 
1538  int i = 0;
1539  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index, ++i)
1540  {
1542  unsigned int index_toread;
1543  fread(&index_toread, sizeof(unsigned int), 1, file);
1544  if (*index != index_toread)
1545  throw cms::Exception("MuonAlignmentFromReference") << "file \"" << *fileName << "\" has index " << index_toread
1546  << " at position " << i << ", but this job is expecting " << *index << " (probably corresponds to the wrong alignment job)" << std::endl;
1547  fitter->read(file, i);
1548  }
1549 
1550  fclose(file);
1551  }
1552 }
int i
Definition: DBlmapReader.cc:9
#define NULL
Definition: scimark2.h:8
std::vector< unsigned int > m_indexes
void read(FILE *file, int which=0)
std::vector< std::string > m_readTemporaryFiles
tuple size
Write out results.
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
void MuonAlignmentFromReference::run ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
overridevirtual

Run the algorithm (must be implemented in derived class)

Implements AlignmentAlgorithmBase.

Definition at line 621 of file MuonAlignmentFromReference.cc.

References AlignmentAlgorithmBase::EventInfo::beamSpot(), reco::TrackBase::dxy(), edm::EventSetup::get(), edm::InputTag::label(), m_alignableNavigator, m_counter_events, m_counter_trackdxy, m_counter_trackmomentum, m_counter_tracks, m_maxDxy, m_maxTrackP, m_maxTrackPt, m_minTrackP, m_muonCollectionTag, reco::TrackBase::p(), reco::BeamSpot::position(), processMuonResidualsFromTrack(), RecoTauCleanerPlugins::pt, reco::TrackBase::pt(), and AlignmentAlgorithmBase::EventInfo::trajTrackPairs().

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

622 {
624 
626  iSetup.get<GlobalTrackingGeometryRecord>().get(globalGeometry);
627 
628  if (m_muonCollectionTag.label().empty()) // use trajectories
629  {
630  const ConstTrajTrackPairCollection &trajtracks = eventInfo.trajTrackPairs();
631  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end(); ++trajtrack)
632  {
634 
635  const Trajectory* traj = (*trajtrack).first;
636  const reco::Track* track = (*trajtrack).second;
637 
638  if (m_minTrackPt < track->pt() && track->pt() < m_maxTrackPt && m_minTrackP < track->p() && track->p() < m_maxTrackP)
639  {
641 
642  if ( fabs(track->dxy(eventInfo.beamSpot().position())) < m_maxDxy )
643  {
645 
646  MuonResidualsFromTrack muonResidualsFromTrack(globalGeometry, traj, track, m_alignableNavigator, 1000.);
647 
648  processMuonResidualsFromTrack(muonResidualsFromTrack);
649  }
650  } // end if track p is within range
651  } // end if track pT is within range
652  }
653  else // use muons
654  {
655  /*
656  for (reco::MuonCollection::const_iterator muon = eventInfo.muonCollection_->begin(); muon != eventInfo.muonCollection_->end(); ++muon)
657  {
658  if ( !(muon->isTrackerMuon() && muon->innerTrack().isNonnull() ) ) continue;
659 
660  m_counter_tracks++;
661 
662  if (m_minTrackPt < muon->pt() && muon->pt() < m_maxTrackPt && m_minTrackP < muon->p() && muon->p() < m_maxTrackP)
663  {
664  m_counter_trackmomentum++;
665 
666  if (fabs(muon->innerTrack()->dxy(eventInfo.beamSpot_.position())) < m_maxDxy)
667  {
668  m_counter_trackdxy++;
669 
670  //std::cout<<" *** will make MuonResidualsFromTrack ***"<<std::endl;
671  MuonResidualsFromTrack muonResidualsFromTrack(globalGeometry, &(*muon), m_alignableNavigator, 100.);
672  //std::cout<<" *** have made MuonResidualsFromTrack ***"<<std::endl;
673 
674  //std::cout<<" trk eta="<<muon->eta()<<" ndof="<<muon->innerTrack()->ndof()<<" nchi2="<<muon->innerTrack()->normalizedChi2()
675  // <<" muresnchi2="<<muonResidualsFromTrack.normalizedChi2()<<" muresnhits="<<muonResidualsFromTrack.trackerNumHits()<<std::endl;
676 
677  processMuonResidualsFromTrack(muonResidualsFromTrack);
678  } // end if track p is within range
679  } // end if track pT is within range
680  } // end loop over tracks
681  */
682  }
683 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:127
void processMuonResidualsFromTrack(MuonResidualsFromTrack &mrft)
double pt() const
track transverse momentum
Definition: TrackBase.h:129
std::string const & label() const
Definition: InputTag.h:42
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:119
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
void MuonAlignmentFromReference::selectResidualsPeaks ( )
private

Definition at line 1596 of file MuonAlignmentFromReference.cc.

References chamberPrettyNameFromId(), gather_cfg::cout, cmsHarvester::index, MuonResidualsFitter::k0010, MuonResidualsFitter::k1010, MuonResidualsFitter::k1100, MuonResidualsFitter::k1110, MuonResidualsFitter::k1111, MuonResidualsFitter::k5DOF, MuonResidualsFitter::k6DOF, MuonResidualsFitter::k6DOFrphi, MuonResiduals5DOFFitter::kResid, MuonResiduals6DOFrphiFitter::kResid, MuonResiduals6DOFFitter::kResidX, MuonResiduals6DOFFitter::kResidY, MuonResiduals5DOFFitter::kResSlope, MuonResiduals6DOFrphiFitter::kResSlope, MuonResiduals6DOFFitter::kResSlopeX, MuonResiduals6DOFFitter::kResSlopeY, m_fitterOrder, m_indexes, m_peakNSigma, MuonResidualsTwoBin::selectPeakResiduals(), MuonResidualsTwoBin::type(), and MuonResidualsTwoBin::useRes().

Referenced by terminate().

1597 {
1598  // should not be called with negative peakNSigma
1599  assert(m_peakNSigma>0.);
1600 
1601  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index)
1602  {
1604 
1605  int nvar = 2;
1606  int vars_index[10] = {0,1};
1607  if (fitter->type() == MuonResidualsFitter::k5DOF)
1608  {
1609  if (fitter->useRes() == MuonResidualsFitter::k1111 || fitter->useRes() == MuonResidualsFitter::k1110 || fitter->useRes() == MuonResidualsFitter::k1010) {
1610  nvar = 2;
1611  vars_index[0] = MuonResiduals5DOFFitter::kResid;
1612  vars_index[1] = MuonResiduals5DOFFitter::kResSlope;
1613  }
1614  else if (fitter->useRes() == MuonResidualsFitter::k1100) {
1615  nvar = 1;
1616  vars_index[0] = MuonResiduals5DOFFitter::kResid;
1617  }
1618  else if (fitter->useRes() == MuonResidualsFitter::k0010) {
1619  nvar = 1;
1620  vars_index[0] = MuonResiduals5DOFFitter::kResSlope;
1621  }
1622  }
1623  else if (fitter->type() == MuonResidualsFitter::k6DOF)
1624  {
1625  if (fitter->useRes() == MuonResidualsFitter::k1111) {
1626  nvar = 4;
1627  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1628  vars_index[1] = MuonResiduals6DOFFitter::kResidY;
1629  vars_index[2] = MuonResiduals6DOFFitter::kResSlopeX;
1630  vars_index[3] = MuonResiduals6DOFFitter::kResSlopeY;
1631  }
1632  else if (fitter->useRes() == MuonResidualsFitter::k1110) {
1633  nvar = 3;
1634  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1635  vars_index[1] = MuonResiduals6DOFFitter::kResidY;
1636  vars_index[2] = MuonResiduals6DOFFitter::kResSlopeX;
1637  }
1638  else if (fitter->useRes() == MuonResidualsFitter::k1010) {
1639  nvar = 2;
1640  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1641  vars_index[2] = MuonResiduals6DOFFitter::kResSlopeX;
1642  }
1643  else if (fitter->useRes() == MuonResidualsFitter::k1100) {
1644  nvar = 2;
1645  vars_index[0] = MuonResiduals6DOFFitter::kResidX;
1646  vars_index[1] = MuonResiduals6DOFFitter::kResidY;
1647  }
1648  else if (fitter->useRes() == MuonResidualsFitter::k0010) {
1649  nvar = 1;
1650  vars_index[0] = MuonResiduals6DOFFitter::kResSlopeX;
1651  }
1652  }
1653  else if (fitter->type() == MuonResidualsFitter::k6DOFrphi)
1654  {
1655  if (fitter->useRes() == MuonResidualsFitter::k1111 || fitter->useRes() == MuonResidualsFitter::k1110 || fitter->useRes() == MuonResidualsFitter::k1010) {
1656  nvar = 2;
1657  vars_index[0] = MuonResiduals6DOFrphiFitter::kResid;
1659  }
1660  else if (fitter->useRes() == MuonResidualsFitter::k1100) {
1661  nvar = 1;
1662  vars_index[0] = MuonResiduals6DOFrphiFitter::kResid;
1663  }
1664  else if (fitter->useRes() == MuonResidualsFitter::k0010) {
1665  nvar = 1;
1667  }
1668  }
1669  else assert(false);
1670 
1671  std::cout<<"selecting in "<<chamberPrettyNameFromId(*index)<<std::endl;
1672 
1673  fitter->selectPeakResiduals(m_peakNSigma, nvar, vars_index);
1674  }
1675 }
std::vector< unsigned int > m_indexes
std::string chamberPrettyNameFromId(unsigned int idx)
tuple cout
Definition: gather_cfg.py:121
void selectPeakResiduals(double nsigma, int nvar, int *vars)
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder
void MuonAlignmentFromReference::startNewLoop ( void  )
inlineoverridevirtual

Call at start of loop Default implementation is dummy for non-iterative algorithms

Reimplemented from AlignmentAlgorithmBase.

Definition at line 82 of file MuonAlignmentFromReference.cc.

82 {};
void MuonAlignmentFromReference::terminate ( const edm::EventSetup iSetup)
overridevirtual

Call at end of each loop (must be implemented in derived class)

Implements AlignmentAlgorithmBase.

Definition at line 845 of file MuonAlignmentFromReference.cc.

References correctBField(), gather_cfg::cout, eraseNotSelectedResiduals(), fillNtuple(), fitAndAlign(), m_BFieldCorrection, m_counter_csc, m_counter_cscaligning, m_counter_cschits, m_counter_cscvalid, m_counter_events, m_counter_minchambers, m_counter_resslopey, m_counter_station123, m_counter_station123aligning, m_counter_station123dt13hits, m_counter_station123dt2hits, m_counter_station123valid, m_counter_station4, m_counter_station4aligning, m_counter_station4hits, m_counter_station4valid, m_counter_totchambers, m_counter_trackdxy, m_counter_trackerchi2, m_counter_trackerhits, m_counter_trackertidtec, m_counter_trackmomentum, m_counter_tracks, m_createNtuple, m_doAlignment, m_peakNSigma, m_readTemporaryFiles, m_writeTemporaryFile, readTmpFiles(), selectResidualsPeaks(), AlCaHLTBitMon_QueryRunRegistry::string, and writeTmpFiles().

846 {
847  // one-time print-out
848  std::cout << "Counters:" << std::endl
849  << "COUNT{ events: " << m_counter_events << " }" << std::endl
850  << "COUNT{ tracks: " << m_counter_tracks << " }" << std::endl
851  << "COUNT{ trackppt: " << m_counter_trackmomentum << " }" << std::endl
852  << "COUNT{ trackdxy: " << m_counter_trackdxy << " }" << std::endl
853  << "COUNT{ trackerhits: " << m_counter_trackerhits << " }" << std::endl
854  << "COUNT{ trackerchi2: " << m_counter_trackerchi2 << " }" << std::endl
855  << "COUNT{ trackertidtec: " << m_counter_trackertidtec << " }" << std::endl
856  << "COUNT{ minnchambers: " << m_counter_minchambers << " }" << std::endl
857  << "COUNT{ totchambers: " << m_counter_totchambers << " }" << std::endl
858  << "COUNT{ station123: " << m_counter_station123 << " }" << std::endl
859  << "COUNT{ station123valid: " << m_counter_station123valid << " }" << std::endl
860  << "COUNT{ station123dt13hits: " << m_counter_station123dt13hits << " }" << std::endl
861  << "COUNT{ station123dt2hits: " << m_counter_station123dt2hits << " }" << std::endl
862  << "COUNT{ station123aligning: " << m_counter_station123aligning << " }" << std::endl
863  << "COUNT{ resslopey: " << m_counter_resslopey << " }" << std::endl
864  << "COUNT{ station4: " << m_counter_station4 << " }" << std::endl
865  << "COUNT{ station4valid: " << m_counter_station4valid << " }" << std::endl
866  << "COUNT{ station4hits: " << m_counter_station4hits << " }" << std::endl
867  << "COUNT{ station4aligning: " << m_counter_station4aligning << " }" << std::endl
868  << "COUNT{ csc: " << m_counter_csc << " }" << std::endl
869  << "COUNT{ cscvalid: " << m_counter_cscvalid << " }" << std::endl
870  << "COUNT{ cschits: " << m_counter_cschits << " }" << std::endl
871  << "COUNT{ cscaligning: " << m_counter_cscaligning << " }" << std::endl
872  << "That's all!" << std::endl;
873 
874  TStopwatch stop_watch;
875 
876  // collect temporary files
877  if (m_readTemporaryFiles.size() != 0)
878  {
879  stop_watch.Start();
880  readTmpFiles();
881  std::cout <<"readTmpFiles took "<< stop_watch.CpuTime() << " sec" << std::endl;
882  stop_watch.Stop();
883  }
884 
885  // select residuals peaks and discard tails if peakNSigma>0 (only while doing alignment)
886  if (m_peakNSigma > 0. && m_doAlignment)
887  {
888  stop_watch.Start();
890  std::cout <<"selectResidualsPeaks took "<< stop_watch.CpuTime() << " sec" << std::endl;
891  stop_watch.Stop();
892  }
893 
895  {
896  stop_watch.Start();
897  correctBField();
898  std::cout <<"correctBField took "<< stop_watch.CpuTime() << " sec" << std::endl;
899  stop_watch.Stop();
900  }
901 
902  // optionally, create an nutuple for easy debugging
903  if (m_createNtuple)
904  {
905  stop_watch.Start();
906  fillNtuple();
907  std::cout <<"fillNtuple took "<< stop_watch.CpuTime() << " sec" << std::endl;
908  stop_watch.Stop();
909  }
910 
911  if (m_doAlignment)
912  {
913  stop_watch.Start();
915  std::cout <<"eraseNotSelectedResiduals took "<< stop_watch.CpuTime() << " sec" << std::endl;
916  stop_watch.Stop();
917  }
918 
919  // fit and align (time-consuming, so the user can turn it off if in a residuals-gathering job)
920  if (m_doAlignment)
921  {
922  stop_watch.Start();
923  fitAndAlign();
924  std::cout <<"fitAndAlign took "<< stop_watch.CpuTime() << " sec" << std::endl;
925  stop_watch.Stop();
926  }
927 
928  // write out the pseudontuples for a later job to collect
930 }
std::vector< std::string > m_readTemporaryFiles
tuple cout
Definition: gather_cfg.py:121
void MuonAlignmentFromReference::writeTmpFiles ( )
private

Definition at line 1555 of file MuonAlignmentFromReference.cc.

References mergeVDriftHistosByStation::file, i, cmsHarvester::index, m_fitterOrder, m_indexes, m_writeTemporaryFile, findQualityFiles::size, and MuonResidualsTwoBin::write().

Referenced by terminate().

1556 {
1557  FILE *file;
1558  file = fopen(m_writeTemporaryFile.c_str(), "w");
1559  int size = m_indexes.size();
1560  fwrite(&size, sizeof(int), 1, file);
1561 
1562  int i = 0;
1563  for (std::vector<unsigned int>::const_iterator index = m_indexes.begin(); index != m_indexes.end(); ++index, ++i)
1564  {
1566  unsigned int index_towrite = *index;
1567  fwrite(&index_towrite, sizeof(unsigned int), 1, file);
1568  fitter->write(file, i);
1569  }
1570 
1571  fclose(file);
1572 }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned int > m_indexes
void write(FILE *file, int which=0)
tuple size
Write out results.
std::map< unsigned int, MuonResidualsTwoBin * > m_fitterOrder

Member Data Documentation

AlignableNavigator* MuonAlignmentFromReference::m_alignableNavigator
private

Definition at line 143 of file MuonAlignmentFromReference.cc.

Referenced by initialize(), run(), and ~MuonAlignmentFromReference().

std::vector<Alignable*> MuonAlignmentFromReference::m_alignables
private

Definition at line 145 of file MuonAlignmentFromReference.cc.

Referenced by fitAndAlign(), and initialize().

AlignmentParameterStore* MuonAlignmentFromReference::m_alignmentParameterStore
private

Definition at line 144 of file MuonAlignmentFromReference.cc.

Referenced by fitAndAlign(), and initialize().

bool MuonAlignmentFromReference::m_allowTIDTEC
private

Definition at line 119 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

int MuonAlignmentFromReference::m_BFieldCorrection
private

Definition at line 137 of file MuonAlignmentFromReference.cc.

Referenced by terminate().

bool MuonAlignmentFromReference::m_combineME11
private
long MuonAlignmentFromReference::m_counter_csc
private
long MuonAlignmentFromReference::m_counter_cscaligning
private
long MuonAlignmentFromReference::m_counter_cschits
private
long MuonAlignmentFromReference::m_counter_cscvalid
private
long MuonAlignmentFromReference::m_counter_events
private

Definition at line 152 of file MuonAlignmentFromReference.cc.

Referenced by MuonAlignmentFromReference(), run(), and terminate().

long MuonAlignmentFromReference::m_counter_minchambers
private
long MuonAlignmentFromReference::m_counter_resslopey
private
long MuonAlignmentFromReference::m_counter_station123
private
long MuonAlignmentFromReference::m_counter_station123aligning
private
long MuonAlignmentFromReference::m_counter_station123dt13hits
private
long MuonAlignmentFromReference::m_counter_station123dt2hits
private
long MuonAlignmentFromReference::m_counter_station123valid
private
long MuonAlignmentFromReference::m_counter_station4
private
long MuonAlignmentFromReference::m_counter_station4aligning
private
long MuonAlignmentFromReference::m_counter_station4hits
private
long MuonAlignmentFromReference::m_counter_station4valid
private
long MuonAlignmentFromReference::m_counter_totchambers
private
long MuonAlignmentFromReference::m_counter_trackdxy
private

Definition at line 155 of file MuonAlignmentFromReference.cc.

Referenced by MuonAlignmentFromReference(), run(), and terminate().

long MuonAlignmentFromReference::m_counter_trackerchi2
private
long MuonAlignmentFromReference::m_counter_trackerhits
private
long MuonAlignmentFromReference::m_counter_trackertidtec
private
long MuonAlignmentFromReference::m_counter_trackmomentum
private

Definition at line 154 of file MuonAlignmentFromReference.cc.

Referenced by MuonAlignmentFromReference(), run(), and terminate().

long MuonAlignmentFromReference::m_counter_tracks
private

Definition at line 153 of file MuonAlignmentFromReference.cc.

Referenced by MuonAlignmentFromReference(), run(), and terminate().

bool MuonAlignmentFromReference::m_createNtuple
private

Definition at line 135 of file MuonAlignmentFromReference.cc.

Referenced by MuonAlignmentFromReference(), and terminate().

bool MuonAlignmentFromReference::m_doAlignment
private

Definition at line 126 of file MuonAlignmentFromReference.cc.

Referenced by MuonAlignmentFromReference(), and terminate().

bool MuonAlignmentFromReference::m_doCSC
private

Definition at line 139 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

bool MuonAlignmentFromReference::m_doDT
private

Definition at line 138 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

std::map<unsigned int,MuonResidualsTwoBin*> MuonAlignmentFromReference::m_fitterOrder
private
std::map<Alignable*,MuonResidualsTwoBin*> MuonAlignmentFromReference::m_fitters
private
std::vector<unsigned int> MuonAlignmentFromReference::m_indexes
private
double MuonAlignmentFromReference::m_maxDxy
private

Definition at line 116 of file MuonAlignmentFromReference.cc.

Referenced by run().

double MuonAlignmentFromReference::m_maxResSlopeY
private

Definition at line 134 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

double MuonAlignmentFromReference::m_maxTrackerRedChi2
private

Definition at line 118 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

double MuonAlignmentFromReference::m_maxTrackP
private

Definition at line 115 of file MuonAlignmentFromReference.cc.

Referenced by run().

double MuonAlignmentFromReference::m_maxTrackPt
private

Definition at line 113 of file MuonAlignmentFromReference.cc.

Referenced by run().

std::map<Alignable*,Alignable*> MuonAlignmentFromReference::m_me11map
private
int MuonAlignmentFromReference::m_minAlignmentHits
private

Definition at line 129 of file MuonAlignmentFromReference.cc.

Referenced by fitAndAlign(), and initialize().

int MuonAlignmentFromReference::m_minCSCHits
private

Definition at line 123 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

int MuonAlignmentFromReference::m_minDT13Hits
private

Definition at line 121 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

int MuonAlignmentFromReference::m_minDT2Hits
private

Definition at line 122 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

int MuonAlignmentFromReference::m_minNCrossedChambers
private

Definition at line 120 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

int MuonAlignmentFromReference::m_minTrackerHits
private

Definition at line 117 of file MuonAlignmentFromReference.cc.

Referenced by processMuonResidualsFromTrack().

double MuonAlignmentFromReference::m_minTrackP
private

Definition at line 114 of file MuonAlignmentFromReference.cc.

Referenced by run().

double MuonAlignmentFromReference::m_minTrackPt
private

Definition at line 112 of file MuonAlignmentFromReference.cc.

edm::InputTag MuonAlignmentFromReference::m_muonCollectionTag
private

Definition at line 110 of file MuonAlignmentFromReference.cc.

Referenced by run().

double MuonAlignmentFromReference::m_peakNSigma
private

Definition at line 136 of file MuonAlignmentFromReference.cc.

Referenced by selectResidualsPeaks(), and terminate().

std::vector<std::string> MuonAlignmentFromReference::m_readTemporaryFiles
private

Definition at line 125 of file MuonAlignmentFromReference.cc.

Referenced by readTmpFiles(), and terminate().

std::vector<std::string> MuonAlignmentFromReference::m_reference
private

Definition at line 111 of file MuonAlignmentFromReference.cc.

Referenced by initialize(), and parseReference().

std::string MuonAlignmentFromReference::m_reportFileName
private

Definition at line 133 of file MuonAlignmentFromReference.cc.

Referenced by fitAndAlign().

std::string MuonAlignmentFromReference::m_residualsModel
private

Definition at line 128 of file MuonAlignmentFromReference.cc.

Referenced by initialize().

int MuonAlignmentFromReference::m_strategy
private

Definition at line 127 of file MuonAlignmentFromReference.cc.

Referenced by initialize().

MuonResidualsFitter::MuonAlignmentTreeRow MuonAlignmentFromReference::m_tree_row
private

Definition at line 179 of file MuonAlignmentFromReference.cc.

Referenced by bookNtuple(), and fillNtuple().

TTree* MuonAlignmentFromReference::m_ttree
private
bool MuonAlignmentFromReference::m_twoBin
private

Definition at line 130 of file MuonAlignmentFromReference.cc.

Referenced by initialize().

std::string MuonAlignmentFromReference::m_useResiduals
private

Definition at line 140 of file MuonAlignmentFromReference.cc.

Referenced by initialize().

bool MuonAlignmentFromReference::m_weightAlignment
private

Definition at line 132 of file MuonAlignmentFromReference.cc.

Referenced by initialize().

std::string MuonAlignmentFromReference::m_writeTemporaryFile
private

Definition at line 124 of file MuonAlignmentFromReference.cc.

Referenced by terminate(), and writeTmpFiles().