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 | Static Private Attributes
HIPAlignmentAlgorithm Class Reference

#include <HIPAlignmentAlgorithm.h>

Inheritance diagram for HIPAlignmentAlgorithm:
AlignmentAlgorithmBase

Public Member Functions

 HIPAlignmentAlgorithm (const edm::ParameterSet &cfg)
 Constructor. More...
 
void initialize (const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store)
 Call at beginning of job. More...
 
void run (const edm::EventSetup &setup, const EventInfo &eventInfo)
 Run the algorithm. More...
 
void startNewLoop (void)
 Called at start of new loop. More...
 
void terminate (const edm::EventSetup &setup)
 Call at end of job. More...
 
 ~HIPAlignmentAlgorithm ()
 Destructor. More...
 
- Public Member Functions inherited from AlignmentAlgorithmBase
virtual bool addCalibrations (const Calibrations &)
 
 AlignmentAlgorithmBase (const edm::ParameterSet &)
 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 processesEvents ()
 Returns whether algorithm proccesses events in current configuration. More...
 
virtual bool setParametersForRunRange (const RunRange &rr)
 
virtual bool storeAlignments ()
 Returns whether algorithm produced results to be stored. More...
 
virtual bool supportsCalibrations ()
 
virtual void terminate ()
 Called at end of job (must be implemented in derived class) More...
 
virtual ~AlignmentAlgorithmBase ()
 Destructor. More...
 

Private Member Functions

void bookRoot (void)
 
double calcAPE (double *par, int iter, double function)
 
bool calcParameters (Alignable *ali, int setDet, double start, double step)
 
void collector (void)
 
int fillEventwiseTree (const char *filename, int iter, int ierr)
 
void fillRoot (const edm::EventSetup &setup)
 
bool processHit1D (const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
 
bool processHit2D (const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
 
int readIterationFile (std::string filename)
 
void setAlignmentPositionError (void)
 
void writeIterationFile (std::string filename, int iter)
 

Private Attributes

std::unique_ptr
< AlignableObjectId
alignableObjectId_
 
double col_cut
 
double cos_cut
 
TTree * hitTree
 
int ioerr
 
bool isCollector
 
bool IsCollision
 
float m2_Eta
 
align::ID m2_Id
 
int m2_Layer
 
int m2_Nhit
 
align::StructureType m2_ObjId
 
float m2_Phi
 
int m2_Type
 
float m2_Xpos
 
float m2_Ypos
 
float m2_Zpos
 
align::ID m3_Id
 
align::StructureType m3_ObjId
 
float m3_par [6]
 
float m_angle
 
float m_Chi2n [MAXREC]
 
float m_d0 [MAXREC]
 
align::ID m_detId
 
float m_dz [MAXREC]
 
float m_Eta [MAXREC]
 
float m_hitwt
 
int m_Nhits [MAXREC]
 
int m_nhPXB [MAXREC]
 
int m_nhPXF [MAXREC]
 
int m_nhTEC [MAXREC]
 
int m_nhTIB [MAXREC]
 
int m_nhTID [MAXREC]
 
int m_nhTOB [MAXREC]
 
int m_Ntracks
 
float m_P [MAXREC]
 
float m_Phi [MAXREC]
 
float m_Pt [MAXREC]
 
float m_sinTheta
 
float m_wt [MAXREC]
 
std::string outfile
 
std::string outfile2
 
std::string outpath
 
std::string salignedfile
 
double Scale
 
std::vector< double > SetScanDet
 
std::string siterationfile
 
std::string smisalignedfile
 
std::string sparameterfile
 
std::string ssurveyfile
 
std::string struefile
 
const std::vector< std::string > surveyResiduals_
 
std::string suvarfile
 
AlignableNavigatortheAlignableDetAccessor
 
std::vector< Alignable * > theAlignables
 
AlignmentParameterStoretheAlignmentParameterStore
 
std::vector< std::pair
< std::vector< Alignable * >
, std::vector< double > > > 
theAPEParameters
 
std::vector< edm::ParameterSettheAPEParameterSet
 
bool theApplyAPE
 
int theCollectorNJobs
 
std::string theCollectorPath
 
int theCurrentPrescale
 
int theEventPrescale
 
TFile * theFile
 
TFile * theFile2
 
TFile * theFile3
 
bool theFillTrackMonitoring
 
AlignmentIORoot theIO
 
std::vector< unsigned > theIOVrangeSet
 
int theIteration
 
std::vector< align::StructureTypetheLevels
 
double theMaxAllowedHitPull
 
double theMaxRelParameterError
 
int theMinimumNumberOfHits
 
bool themultiIOV
 
TTree * theTree
 
TTree * theTree2
 
TTree * theTree3
 
bool trackPs
 
bool trackWt
 
bool uniEta
 
bool verbose
 

Static Private Attributes

static const int MAXREC = 99
 

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

Definition at line 22 of file HIPAlignmentAlgorithm.h.

Constructor & Destructor Documentation

HIPAlignmentAlgorithm::HIPAlignmentAlgorithm ( const edm::ParameterSet cfg)

Constructor.

Definition at line 48 of file HIPAlignmentAlgorithm.cc.

References col_cut, cos_cut, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isCollector, IsCollision, outfile, outfile2, outpath, salignedfile, Scale, SetScanDet, siterationfile, smisalignedfile, sparameterfile, ssurveyfile, AlCaHLTBitMon_QueryRunRegistry::string, struefile, suvarfile, theAPEParameterSet, theApplyAPE, theCollectorNJobs, theCollectorPath, theCurrentPrescale, theEventPrescale, theFillTrackMonitoring, theIOVrangeSet, theMaxAllowedHitPull, theMaxRelParameterError, theMinimumNumberOfHits, themultiIOV, trackPs, trackWt, and uniEta.

48  :
50  surveyResiduals_(cfg.getUntrackedParameter<std::vector<std::string> >("surveyResiduals"))
51 {
52 
53  // parse parameters
54 
55  verbose = cfg.getParameter<bool>("verbosity");
56  outpath = cfg.getParameter<std::string>("outpath");
57  outfile = cfg.getParameter<std::string>("outfile");
58  outfile2 = cfg.getParameter<std::string>("outfile2");
59  struefile = cfg.getParameter<std::string>("trueFile");
60  smisalignedfile = cfg.getParameter<std::string>("misalignedFile");
61  salignedfile = cfg.getParameter<std::string>("alignedFile");
62  siterationfile = cfg.getParameter<std::string>("iterationFile");
63  suvarfile = cfg.getParameter<std::string>("uvarFile");
64  sparameterfile = cfg.getParameter<std::string>("parameterFile");
65  ssurveyfile = cfg.getParameter<std::string>("surveyFile");
66 
67  outfile =outpath+outfile;//Eventwise tree
68  outfile2 =outpath+outfile2;//Alignablewise tree
69  struefile =outpath+struefile;
70  smisalignedfile=outpath+smisalignedfile;
71  salignedfile =outpath+salignedfile;
72  siterationfile =outpath+siterationfile;
73  suvarfile =outpath+suvarfile;
74  sparameterfile =outpath+sparameterfile;
75  ssurveyfile =outpath+ssurveyfile;
76 
77  // parameters for APE
78  theApplyAPE = cfg.getParameter<bool>("applyAPE");
79  themultiIOV = cfg.getParameter<bool>("multiIOV");
80  theAPEParameterSet = cfg.getParameter<std::vector<edm::ParameterSet> >("apeParam");
81  theIOVrangeSet = cfg.getParameter<std::vector<unsigned> >("IOVrange");
82 
83  theMaxAllowedHitPull = cfg.getParameter<double>("maxAllowedHitPull");
84  theMinimumNumberOfHits = cfg.getParameter<int>("minimumNumberOfHits");
85  theMaxRelParameterError = cfg.getParameter<double>("maxRelParameterError");
86 
87  // for collector mode (parallel processing)
88  isCollector=cfg.getParameter<bool>("collectorActive");
89  theCollectorNJobs=cfg.getParameter<int>("collectorNJobs");
90  theCollectorPath=cfg.getParameter<std::string>("collectorPath");
91  theFillTrackMonitoring=cfg.getUntrackedParameter<bool>("fillTrackMonitoring");
92 
93  if (isCollector) edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Collector mode";
94 
95  theEventPrescale = cfg.getParameter<int>("eventPrescale");
97 
98 //CY : added options
99  trackPs = cfg.getParameter<bool>("UsePreSelection");
100  trackWt = cfg.getParameter<bool>("UseReweighting");
101  Scale = cfg.getParameter<double>("Weight");
102  uniEta = cfg.getParameter<bool>("UniformEta");
103  IsCollision = cfg.getParameter<bool>("isCollision");
104  SetScanDet=cfg.getParameter<std::vector<double> >("setScanDet");
105  col_cut = cfg.getParameter<double>("CLAngleCut");
106  cos_cut = cfg.getParameter<double>("CSAngleCut");
107 
108  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] constructed.";
109 
110 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< unsigned > theIOVrangeSet
AlignmentAlgorithmBase(const edm::ParameterSet &)
Constructor.
std::vector< double > SetScanDet
std::vector< edm::ParameterSet > theAPEParameterSet
const std::vector< std::string > surveyResiduals_
HIPAlignmentAlgorithm::~HIPAlignmentAlgorithm ( )
inline

Destructor.

Definition at line 31 of file HIPAlignmentAlgorithm.h.

31 {};

Member Function Documentation

void HIPAlignmentAlgorithm::bookRoot ( void  )
private

Definition at line 1090 of file HIPAlignmentAlgorithm.cc.

References hitTree, m2_Eta, m2_Id, m2_Layer, m2_Nhit, m2_ObjId, m2_Phi, m2_Type, m2_Xpos, m2_Ypos, m2_Zpos, m3_Id, m3_ObjId, m3_par, m_angle, m_Chi2n, m_d0, m_detId, m_dz, m_Eta, m_hitwt, m_Nhits, m_nhPXB, m_nhPXF, m_nhTEC, m_nhTIB, m_nhTID, m_nhTOB, m_Ntracks, m_P, m_Phi, m_Pt, m_sinTheta, m_wt, outfile, outfile2, ssurveyfile, theFile, theFile2, theFile3, theFillTrackMonitoring, theIteration, theLevels, theTree, theTree2, theTree3, and cond::persistency::GLOBAL_TAG::tname.

Referenced by startNewLoop().

1091 {
1092  TString tname="T1";
1093  char iterString[5];
1094  snprintf(iterString, sizeof(iterString), "%i",theIteration);
1095  tname.Append("_");
1096  tname.Append(iterString);
1097 
1098  // create ROOT files
1099  if (theFillTrackMonitoring) {
1100  theFile = new TFile(outfile.c_str(),"update");
1101  theFile->cd();
1102 
1103  // book event-wise ROOT Tree
1104 
1105  TString tname_hit="T1_hit";
1106  tname_hit.Append("_");
1107  tname_hit.Append(iterString);
1108 
1109  theTree = new TTree(tname,"Eventwise tree");
1110 
1111  //theTree->Branch("Run", &m_Run, "Run/I");
1112  //theTree->Branch("Event", &m_Event, "Event/I");
1113  theTree->Branch("Ntracks", &m_Ntracks, "Ntracks/I");
1114  theTree->Branch("Nhits", m_Nhits, "Nhits[Ntracks]/I");
1115  theTree->Branch("nhPXB", m_nhPXB, "nhPXB[Ntracks]/I");
1116  theTree->Branch("nhPXF", m_nhPXF, "nhPXF[Ntracks]/I");
1117  theTree->Branch("nhTIB", m_nhTIB, "nhTIB[Ntracks]/I");
1118  theTree->Branch("nhTOB", m_nhTOB, "nhTOB[Ntracks]/I");
1119  theTree->Branch("nhTID", m_nhTID, "nhTID[Ntracks]/I");
1120  theTree->Branch("nhTEC", m_nhTEC, "nhTEC[Ntracks]/I");
1121  theTree->Branch("Pt", m_Pt, "Pt[Ntracks]/F");
1122  theTree->Branch("P", m_P, "P[Ntracks]/F");
1123  theTree->Branch("Eta", m_Eta, "Eta[Ntracks]/F");
1124  theTree->Branch("Phi", m_Phi, "Phi[Ntracks]/F");
1125  theTree->Branch("Chi2n", m_Chi2n, "Chi2n[Ntracks]/F");
1126  theTree->Branch("d0", m_d0, "d0[Ntracks]/F");
1127  theTree->Branch("dz", m_dz, "dz[Ntracks]/F");
1128  theTree->Branch("wt", m_wt, "wt[Ntracks]/F");
1129 
1130  hitTree = new TTree(tname_hit,"Hitwise tree");
1131  hitTree->Branch("Id", &m_detId, "Id/i");
1132  hitTree->Branch("sinTheta", &m_sinTheta, "sinTheta/F");
1133  hitTree->Branch("hitImpactAngle", &m_angle, "hitImpactAngle/F");
1134  hitTree->Branch("wt", &m_hitwt,"wt/F");
1135  }
1136  // book Alignable-wise ROOT Tree
1137 
1138  theFile2 = new TFile(outfile2.c_str(),"update");
1139  theFile2->cd();
1140 
1141  theTree2 = new TTree("T2","Alignablewise tree");
1142 
1143  theTree2->Branch("Nhit", &m2_Nhit, "Nhit/I");
1144  theTree2->Branch("Type", &m2_Type, "Type/I");
1145  theTree2->Branch("Layer", &m2_Layer, "Layer/I");
1146  theTree2->Branch("Xpos", &m2_Xpos, "Xpos/F");
1147  theTree2->Branch("Ypos", &m2_Ypos, "Ypos/F");
1148  theTree2->Branch("Zpos", &m2_Zpos, "Zpos/F");
1149  theTree2->Branch("Eta", &m2_Eta, "Eta/F");
1150  theTree2->Branch("Phi", &m2_Phi, "Phi/F");
1151  theTree2->Branch("Id", &m2_Id, "Id/i");
1152  theTree2->Branch("ObjId", &m2_ObjId, "ObjId/I");
1153 
1154  // book survey-wise ROOT Tree only if survey is enabled
1155  if (theLevels.size() > 0){
1156 
1157  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::bookRoot] Survey trees booked.";
1158  theFile3 = new TFile(ssurveyfile.c_str(),"update");
1159  theFile3->cd();
1160  theTree3 = new TTree(tname, "Survey Tree");
1161  theTree3->Branch("Id", &m3_Id, "Id/i");
1162  theTree3->Branch("ObjId", &m3_ObjId, "ObjId/I");
1163  theTree3->Branch("Par", &m3_par, "Par[6]/F");
1164  }
1165 
1166  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::bookRoot] Root trees booked.";
1167 
1168 }
static char const * tname
Definition: GTSchema.h:13
align::StructureType m2_ObjId
align::StructureType m3_ObjId
std::vector< align::StructureType > theLevels
double HIPAlignmentAlgorithm::calcAPE ( double *  par,
int  iter,
double  function 
)
private

Definition at line 1062 of file HIPAlignmentAlgorithm.cc.

References assert(), create_public_lumi_plots::exp, bookConverter::max, and funct::pow().

Referenced by setAlignmentPositionError().

1063 {
1064  double diter=(double)iter;
1065 
1066  // The following floating-point equality check is safe because this
1067  // "0." and this "1." are generated by the compiler, in the very
1068  // same file. Whatever approximization scheme it uses to turn "1."
1069  // into 0.9999999999998 in the HIPAlignmentAlgorithm::initialize is
1070  // also used here. If I'm wrong, you'll get an assertion.
1071  if (function == 0.) {
1072  return std::max(par[1],par[0]+((par[1]-par[0])/par[2])*diter);
1073  }
1074  else if (function == 1.) {
1075  return std::max(0.,par[0]*(exp(-pow(diter,par[1])/par[2])));
1076  }
1077  else if (function == 2.) {
1078  int ipar2 = (int) par[2];
1079  int step = iter/ipar2;
1080  double dstep = (double) step;
1081  return std::max(0.0, par[0] - par[1]*dstep);
1082  }
1083  else assert(false); // should have been caught in the constructor
1084 }
assert(m_qm.get())
step
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool HIPAlignmentAlgorithm::calcParameters ( Alignable ali,
int  setDet,
double  start,
double  step 
)
private

Definition at line 1256 of file HIPAlignmentAlgorithm.cc.

References HIPUserVariables::alierr, Alignable::alignmentParameters(), HIPUserVariables::alipar, AlignmentParameters::cloneFromSelected(), i, Alignable::id(), HIPUserVariables::jtve, HIPUserVariables::jtvj, HIPUserVariables::nhit, Alignable::setAlignmentParameters(), AlignmentParameters::setValid(), mathSSE::sqrt(), command_line::start, theIteration, theMaxRelParameterError, theMinimumNumberOfHits, and AlignmentParameters::userVariables().

Referenced by terminate().

1257 {
1258  // Alignment parameters
1260  // access user variables
1261  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(par->userVariables());
1262  int nhit = uservar->nhit;
1263  // The following variable is needed for the extended 1D/2D hit fix using
1264  // matrix shrinkage and expansion
1265  // int hitdim = uservar->hitdim;
1266 
1267  edm::LogWarning("Alignment") << "Processing Detector"<<ali->id() ;
1268 
1269  if ( (setDet==0) && (nhit < theMinimumNumberOfHits)) {
1270  par->setValid(false);
1271  edm::LogWarning("Alignment") << "nhit="<<nhit<<" too small,skip!" ;
1272  return false;
1273  }
1274 
1275  AlgebraicSymMatrix jtvj = uservar->jtvj;
1276  AlgebraicVector jtve = uservar->jtve;
1277 
1278 
1279  // these are the alignment corrections+covariance (for selected params)
1280 
1281 
1282  int npar = jtve.num_row();
1283  AlgebraicVector params(npar);
1284  AlgebraicVector paramerr(npar);
1285  AlgebraicSymMatrix cov(npar*npar);
1286 
1287  if (setDet!=0) {
1288  if (params.num_row()!=1){
1289  edm::LogError("Alignment") << "For scanning, please only turn on one parameter! check common_cff_py.txt";
1290  return false;
1291  }
1292  if (theIteration==1) params[0] = start;
1293  else params[0]=step;
1294  }
1295 
1296 // edm::LogWarning("Alignment") << "parameters " << params;
1297 
1298  // errors of parameters
1299 
1300  if (setDet==0){
1301  int ierr;
1302  AlgebraicSymMatrix jtvjinv = jtvj.inverse(ierr);
1303 
1304  if (ierr !=0) {
1305  edm::LogError("Alignment") << "Matrix inversion failed!";
1306  return false;
1307  }
1308  params = - (jtvjinv * jtve);
1309  cov = jtvjinv;
1310 
1311 // edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::CalcParameters]: parameters before RelErrCut= " << params;
1312 // edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::CalcParameters]: cov= " << cov;
1313  AlgebraicVector relerr(npar);
1314  for (int i=0;i<npar;i++) {
1315  if (fabs(cov[i][i])>0) paramerr[i] = sqrt(fabs(cov[i][i]));
1316  else paramerr[i] = params[i];
1317  if (params[i]!=0) relerr[i] = fabs(paramerr[i]/params[i]);
1318  else relerr[i]=0;
1319  if (relerr[i] >= theMaxRelParameterError) {
1320 // edm::LogWarning("Alignment") << "RelError="<<relerr[i]<<"too large!" ;
1321  params[i] = 0;
1322  paramerr[i]=0;
1323  }
1324  }
1325  }
1326 
1327  if (setDet!=0)
1328  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::CalcParameters]: parameters = " << params;
1329 
1330  uservar->alipar=params;
1331  uservar->alierr=paramerr;
1332 
1333  AlignmentParameters* parnew = par->cloneFromSelected(params,cov);
1334  ali->setAlignmentParameters(parnew);
1335  parnew->setValid(true);
1336 
1337  return true;
1338 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:185
int i
Definition: DBlmapReader.cc:9
AlgebraicVector alipar
AlgebraicVector jtve
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
AlgebraicSymMatrix jtvj
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:110
void setValid(bool v)
Set validity flag.
AlgebraicVector alierr
T sqrt(T t)
Definition: SSEVec.h:18
CLHEP::HepVector AlgebraicVector
CLHEP::HepSymMatrix AlgebraicSymMatrix
step
virtual AlignmentParameters * cloneFromSelected(const AlgebraicVector &par, const AlgebraicSymMatrix &cov) const =0
void HIPAlignmentAlgorithm::collector ( void  )
private

Definition at line 1342 of file HIPAlignmentAlgorithm.cc.

References HIPUserVariables::alichi2, Alignable::alignmentParameters(), HIPUserVariables::alindof, AlignmentParameterStore::attachUserVariables(), HIPUserVariables::clone(), fillEventwiseTree(), ioerr, HIPUserVariables::jtve, HIPUserVariables::jtvj, HIPUserVariables::nhit, HIPUserVariablesIORoot::readHIPUserVariables(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, theAlignables, theAlignmentParameterStore, theCollectorNJobs, theCollectorPath, theFillTrackMonitoring, theIteration, and AlignmentParameters::userVariables().

Referenced by startNewLoop().

1343 {
1344  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::collector] called for iteration "
1345  << theIteration << std::endl;
1346 
1347  HIPUserVariablesIORoot HIPIO;
1348 
1349 
1350  for (int ijob=1;ijob<=theCollectorNJobs;ijob++) {
1351 
1352  edm::LogWarning("Alignment") << "reading uservar for job " << ijob;
1353 
1354  std::stringstream ss;
1355  std::string str;
1356  ss << ijob;
1357  ss >> str;
1358  std::string uvfile = theCollectorPath+"/job"+str+"/IOUserVariables.root";
1359 
1360  std::vector<AlignmentUserVariables*> uvarvec =
1361  HIPIO.readHIPUserVariables(theAlignables, uvfile.c_str(),
1362  theIteration, ioerr);
1363 
1364  if (ioerr!=0) {
1365  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::collector] could not read user variable files for job "
1366  << ijob;
1367  continue;
1368  }
1369 
1370  // add
1371  std::vector<AlignmentUserVariables*> uvarvecadd;
1372  std::vector<AlignmentUserVariables*>::const_iterator iuvarnew=uvarvec.begin();
1373  for (std::vector<Alignable*>::const_iterator it=theAlignables.begin();
1374  it!=theAlignables.end();
1375  ++it) {
1376  Alignable* ali = *it;
1378 
1379  HIPUserVariables* uvarold = dynamic_cast<HIPUserVariables*>(ap->userVariables());
1380  HIPUserVariables* uvarnew = dynamic_cast<HIPUserVariables*>(*iuvarnew);
1381 
1382  HIPUserVariables* uvar = uvarold->clone();
1383  if (uvarnew!=0) {
1384  //edm::LogWarning("Alignment") << "[collector-job"<<ijob<<"]alignables:old_nhit:"<<(uvarold->nhit)<<" new_nhit:"<<(uvarnew->nhit);
1385 
1386  uvar->nhit = (uvarold->nhit)+(uvarnew->nhit);
1387  uvar->jtvj = (uvarold->jtvj)+(uvarnew->jtvj);
1388  uvar->jtve = (uvarold->jtve)+(uvarnew->jtve);
1389  uvar->alichi2 = (uvarold->alichi2)+(uvarnew->alichi2);
1390  uvar->alindof = (uvarold->alindof)+(uvarnew->alindof);
1391  delete uvarnew;
1392  }
1393 
1394  uvarvecadd.push_back(uvar);
1395  iuvarnew++;
1396  }
1397 
1399 
1400  //fill Eventwise Tree
1401  if (theFillTrackMonitoring) {
1402  uvfile = theCollectorPath+"/job"+str+"/HIPAlignmentEvents.root";
1403  edm::LogWarning("Alignment") << "Added to the tree "
1404  << fillEventwiseTree(uvfile.c_str(), theIteration, ioerr)
1405  << "tracks";
1406  }
1407 
1408  }//end loop on jobs
1409 }
void attachUserVariables(const align::Alignables &alivec, const std::vector< AlignmentUserVariables * > &uvarvec, int &ierr)
Attach User Variables to given alignables.
AlignmentParameterStore * theAlignmentParameterStore
int fillEventwiseTree(const char *filename, int iter, int ierr)
AlgebraicVector jtve
HIPUserVariables * clone(void) const
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
AlgebraicSymMatrix jtvj
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
std::vector< AlignmentUserVariables * > readHIPUserVariables(const Alignables &alivec, const char *filename, int iter, int &ierr)
std::vector< Alignable * > theAlignables
int HIPAlignmentAlgorithm::fillEventwiseTree ( const char *  filename,
int  iter,
int  ierr 
)
private

Definition at line 1413 of file HIPAlignmentAlgorithm.cc.

References hitTree, m_angle, m_Chi2n, m_d0, m_detId, m_dz, m_Eta, m_hitwt, m_Nhits, m_nhPXB, m_nhPXF, m_nhTEC, m_nhTIB, m_nhTID, m_nhTOB, m_Ntracks, m_P, m_Phi, m_Pt, m_sinTheta, m_wt, MAXREC, and theTree.

Referenced by collector().

1414 {
1415  int totntrk = 0;
1416  char treeName[64];
1417  snprintf(treeName, sizeof(treeName), "T1_%d", iter);
1418 //CY: hit tree
1419  char hitTreeName[64];
1420  snprintf(hitTreeName, sizeof(hitTreeName), "T1_hit_%d", iter);
1421 
1422 
1423  //open the file "HIPAlignmentEvents.root" in the job directory
1424  TFile *jobfile = new TFile(filename, "READ");
1425  //grab the tree corresponding to this iteration
1426  TTree *jobtree = (TTree*)jobfile->Get(treeName);
1427  TTree *hittree = (TTree*)jobfile->Get(hitTreeName);
1428  //address and read the variables
1429  static const int nmaxtrackperevent = 1000;
1430  int jobNtracks, jobNhitspertrack[nmaxtrackperevent], jobnhPXB[nmaxtrackperevent], jobnhPXF[nmaxtrackperevent],jobnhTIB[nmaxtrackperevent], jobnhTOB[nmaxtrackperevent],jobnhTID[nmaxtrackperevent], jobnhTEC[nmaxtrackperevent];
1431  float jobP[nmaxtrackperevent], jobPt[nmaxtrackperevent], jobEta[nmaxtrackperevent] , jobPhi[nmaxtrackperevent];
1432  float jobd0[nmaxtrackperevent],jobwt[nmaxtrackperevent], jobdz[nmaxtrackperevent] , jobChi2n[nmaxtrackperevent];
1433  float jobsinTheta,jobHitWt,jobangle;
1434  align::ID jobDetId;
1435 
1436  jobtree->SetBranchAddress("Ntracks", &jobNtracks);
1437  jobtree->SetBranchAddress("Nhits", jobNhitspertrack);
1438  jobtree->SetBranchAddress("nhPXB", jobnhPXB);
1439  jobtree->SetBranchAddress("nhPXF", jobnhPXF);
1440  jobtree->SetBranchAddress("nhTIB", jobnhTIB);
1441  jobtree->SetBranchAddress("nhTOB", jobnhTOB);
1442  jobtree->SetBranchAddress("nhTID", jobnhTID);
1443  jobtree->SetBranchAddress("nhTEC", jobnhTEC);
1444  jobtree->SetBranchAddress("Pt", jobPt);
1445  jobtree->SetBranchAddress("P", jobP);
1446  jobtree->SetBranchAddress("d0", jobd0);
1447  jobtree->SetBranchAddress("dz", jobdz);
1448  jobtree->SetBranchAddress("Eta", jobEta);
1449  jobtree->SetBranchAddress("Phi", jobPhi);
1450  jobtree->SetBranchAddress("Chi2n", jobChi2n);
1451  jobtree->SetBranchAddress("wt", jobwt);
1452 
1453 // CY: hit info
1454  hittree->SetBranchAddress("sinTheta", &jobsinTheta);
1455  hittree->SetBranchAddress("HitImpactAngle", &jobangle);
1456  hittree->SetBranchAddress("Id", &jobDetId);
1457  hittree->SetBranchAddress("wt", &jobHitWt);
1458 
1459  int ievent = 0;
1460  for (ievent=0;ievent<jobtree->GetEntries();++ievent) {
1461  jobtree->GetEntry(ievent);
1462 
1463  //fill the collector tree with them
1464 
1465  // TO BE IMPLEMENTED: a prescale factor like in run()
1466  m_Ntracks = jobNtracks;
1467  int ntrk = 0;
1468  while (ntrk<m_Ntracks) {
1469  if (ntrk<MAXREC) {
1470  totntrk = ntrk+1;
1471  m_Nhits[ntrk] = jobNhitspertrack[ntrk];
1472  m_Pt[ntrk] = jobPt[ntrk];
1473  m_P[ntrk] = jobP[ntrk];
1474  m_nhPXB[ntrk] = jobnhPXB[ntrk];
1475  m_nhPXF[ntrk] = jobnhPXF[ntrk];
1476  m_nhTIB[ntrk] = jobnhTIB[ntrk];
1477  m_nhTOB[ntrk] = jobnhTOB[ntrk];
1478  m_nhTID[ntrk] = jobnhTID[ntrk];
1479  m_nhTEC[ntrk] = jobnhTEC[ntrk];
1480  m_Eta[ntrk] = jobEta[ntrk];
1481  m_Phi[ntrk] = jobPhi[ntrk];
1482  m_Chi2n[ntrk] = jobChi2n[ntrk];
1483  m_d0[ntrk] = jobd0[ntrk];
1484  m_dz[ntrk] = jobdz[ntrk];
1485  m_wt[ntrk] = jobwt[ntrk];
1486  }//end if j<MAXREC
1487  else{
1488  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::fillEventwiseTree] Number of tracks in Eventwise tree exceeds MAXREC: "
1489  << m_Ntracks << " Skipping exceeding tracks.";
1490  ntrk = m_Ntracks+1;
1491  }
1492  ++ntrk;
1493  }//end while loop
1494  theTree->Fill();
1495  }//end loop on i - entries in the job tree
1496 
1497  int ihit = 0;
1498  for (ihit=0;ihit<hittree->GetEntries();++ihit) {
1499  hittree->GetEntry(ihit);
1500  m_angle = jobangle;
1501  m_sinTheta = jobsinTheta;
1502  m_detId = jobDetId;
1503  m_hitwt=jobHitWt;
1504  hitTree->Fill();
1505  }
1506 
1507  //clean up
1508  delete jobtree;
1509  delete hittree;
1510  delete jobfile;
1511 
1512  return totntrk;
1513 }//end fillEventwiseTree
uint32_t ID
Definition: Definitions.h:26
tuple filename
Definition: lut2db_cfg.py:20
void HIPAlignmentAlgorithm::fillRoot ( const edm::EventSetup setup)
private

Definition at line 1173 of file HIPAlignmentAlgorithm.cc.

References Alignable::alignableObjectId(), Alignable::alignmentParameters(), PV3DBase< T, PVType, FrameType >::eta(), edm::EventSetup::get(), Alignable::id(), AlignmentParameters::isValid(), m2_Eta, m2_Id, m2_Layer, m2_Nhit, m2_ObjId, m2_Phi, m2_Type, m2_Xpos, m2_Ypos, m2_Zpos, HIPUserVariables::nhit, AlignmentParameters::parameters(), PV3DBase< T, PVType, FrameType >::phi(), GloballyPositioned< T >::position(), edm::ESHandle< class >::product(), Alignable::surface(), theAlignables, theAlignmentParameterStore, theFile2, theTree2, AlignmentParameterStore::typeAndLayer(), AlignmentParameters::userVariables(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by terminate().

1174 {
1175  using std::setw;
1176  theFile2->cd();
1177 
1178  int naligned=0;
1179 
1180  //Retrieve tracker topology from geometry
1181  edm::ESHandle<TrackerTopology> tTopoHandle;
1182 // iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
1183  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
1184 
1185  const TrackerTopology* const tTopo = tTopoHandle.product();
1186 
1187  for (std::vector<Alignable*>::const_iterator it=theAlignables.begin();
1188  it!=theAlignables.end();
1189  ++it) {
1190  Alignable* ali = (*it);
1192 
1193  // consider only those parameters classified as 'valid'
1194  if (dap->isValid()) {
1195 
1196  // get number of hits from user variable
1197  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(dap->userVariables());
1198  m2_Nhit = uservar->nhit;
1199 
1200  // get type/layer
1201  std::pair<int,int> tl = theAlignmentParameterStore->typeAndLayer(ali, tTopo);
1202  m2_Type = tl.first;
1203  m2_Layer = tl.second;
1204 
1205  // get identifier (as for IO)
1206  m2_Id = ali->id();
1207  m2_ObjId = ali->alignableObjectId();
1208 
1209  // get position
1210  GlobalPoint pos = ali->surface().position();
1211  m2_Xpos = pos.x();
1212  m2_Ypos = pos.y();
1213  m2_Zpos = pos.z();
1214  m2_Eta = pos.eta();
1215  m2_Phi = pos.phi();
1216 
1217  AlgebraicVector pars = dap->parameters();
1218 
1219  if (verbose) {
1220  edm::LogVerbatim("Alignment")
1221  << "------------------------------------------------------------------------\n"
1222  << " ALIGNABLE: " << setw(6) << naligned
1223  << '\n'
1224  << "hits: " << setw(4) << m2_Nhit
1225  << " type: " << setw(4) << m2_Type
1226  << " layer: " << setw(4) << m2_Layer
1227  << " id: " << setw(4) << m2_Id
1228  << " objId: " << setw(4) << m2_ObjId
1229  << '\n'
1230  << std::fixed << std::setprecision(5)
1231  << "x,y,z: "
1232  << setw(12) << m2_Xpos
1233  << setw(12) << m2_Ypos
1234  << setw(12) << m2_Zpos
1235  << " eta,phi: "
1236  << setw(12) << m2_Eta
1237  << setw(12) << m2_Phi
1238  << '\n'
1239  << "params: "
1240  << setw(12) << pars[0]
1241  << setw(12) << pars[1]
1242  << setw(12) << pars[2]
1243  << setw(12) << pars[3]
1244  << setw(12) << pars[4]
1245  << setw(12) << pars[5];
1246  }
1247 
1248  naligned++;
1249  theTree2->Fill();
1250  }
1251  }
1252 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:185
AlignmentParameterStore * theAlignmentParameterStore
std::pair< int, int > typeAndLayer(const Alignable *ali, const TrackerTopology *tTopo) const
Obtain type and layer from Alignable.
align::StructureType m2_ObjId
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
T z() const
Definition: PV3DBase.h:64
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
CLHEP::HepVector AlgebraicVector
T const * product() const
Definition: ESHandle.h:86
T eta() const
Definition: PV3DBase.h:76
bool isValid(void) const
Get validity flag.
T x() const
Definition: PV3DBase.h:62
const PositionType & position() const
std::vector< Alignable * > theAlignables
void HIPAlignmentAlgorithm::initialize ( const edm::EventSetup setup,
AlignableTracker tracker,
AlignableMuon muon,
AlignableExtras extras,
AlignmentParameterStore store 
)
virtual

Call at beginning of job.

Implements AlignmentAlgorithmBase.

Definition at line 115 of file HIPAlignmentAlgorithm.cc.

References AlignmentParameterSelector::addSelections(), alignableObjectId_, AlignmentParameterStore::alignables(), ALCARECOPromptCalibProdSiPixelAli0T_cff::alignParams, AlignmentParameterSelector::clear(), AlignableObjectId::commonObjectIdProvider(), edm::IOVSyncValue::eventID(), Exception, edm::ValidityInterval::first(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), i, isCollector, testEve_cfg::level, outfile2, edm::EventID::run(), salignedfile, AlignmentParameterSelector::selectedAlignables(), siterationfile, ssurveyfile, AlCaHLTBitMon_QueryRunRegistry::string, surveyResiduals_, suvarfile, theAlignableDetAccessor, theAlignables, theAlignmentParameterStore, theAPEParameters, theAPEParameterSet, theApplyAPE, theIOVrangeSet, theLevels, and themultiIOV.

118 {
119  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Initializing...";
120 
121  alignableObjectId_ = std::make_unique<AlignableObjectId>
123 
124  for (const auto& level: surveyResiduals_) {
125  theLevels.push_back(alignableObjectId_->stringToId(level));
126  }
127 
128  edm::ESHandle<Alignments> globalPositionRcd;
129 
130  const edm::ValidityInterval & validity = setup.get<TrackerAlignmentRcd>().validityInterval();
131  const edm::IOVSyncValue first1 = validity.first();
132  unsigned int firstrun = first1.eventID().run();
133  if(themultiIOV){
134  if(theIOVrangeSet.size()!=1){
135  bool findMatchIOV=false;
136  for (unsigned int iovl = 0; iovl <theIOVrangeSet.size(); iovl++){
137  if(firstrun == theIOVrangeSet.at(iovl)){
138  std::string iovapp = std::to_string(firstrun);
139  iovapp.append(".root");
140  iovapp.insert(0,"_");
141  salignedfile.replace(salignedfile.end()-5, salignedfile.end(),iovapp);
142  siterationfile.replace(siterationfile.end()-5, siterationfile.end(),iovapp);
143  //sparameterfile.replace(sparameterfile.end()-5, sparameterfile.end(),iovapp);
144  if(isCollector){
145  outfile2.replace(outfile2.end()-5, outfile2.end(),iovapp);
146  ssurveyfile.replace(ssurveyfile.end()-5, ssurveyfile.end(),iovapp);
147  suvarfile.replace(suvarfile.end()-5, suvarfile.end(),iovapp);
148  }
149 
150  findMatchIOV=true;
151  break;
152  }
153  }
154  if(!findMatchIOV){
155  edm::LogWarning("Alignment") << "error! Didn't find the matched IOV file!";
156  }
157  }
158  else{
159  std::string iovapp = std::to_string(theIOVrangeSet.at(0));
160  iovapp.append(".root");
161  iovapp.insert(0,"_");
162  salignedfile.replace(salignedfile.end()-5, salignedfile.end(),iovapp);
163  siterationfile.replace(siterationfile.end()-5, siterationfile.end(),iovapp);
164  }
165  }
166 
167  // accessor Det->AlignableDet
168  if ( !muon )
170  else if ( !tracker )
172  else
173  theAlignableDetAccessor = new AlignableNavigator(tracker, muon);
174 
175  // set alignmentParameterStore
177 
178  // get alignables
180 
181  // clear theAPEParameters, if necessary
182  theAPEParameters.clear();
183 
184  // get APE parameters
185  if(theApplyAPE){
186  AlignmentParameterSelector selector(tracker, muon);
187  for (std::vector<edm::ParameterSet>::const_iterator setiter = theAPEParameterSet.begin();
188  setiter != theAPEParameterSet.end();
189  ++setiter) {
190  std::vector<Alignable*> alignables;
191 
192  selector.clear();
193  edm::ParameterSet selectorPSet = setiter->getParameter<edm::ParameterSet>("Selector");
194  std::vector<std::string> alignParams = selectorPSet.getParameter<std::vector<std::string> >("alignParams");
195  if (alignParams.size() == 1 && alignParams[0] == std::string("selected")) {
196  alignables = theAlignables;
197  }
198  else {
199  selector.addSelections(selectorPSet);
200  alignables = selector.selectedAlignables();
201  }
202 
203  std::vector<double> apeSPar = setiter->getParameter<std::vector<double> >("apeSPar");
204  std::vector<double> apeRPar = setiter->getParameter<std::vector<double> >("apeRPar");
205  std::string function = setiter->getParameter<std::string>("function");
206 
207  if (apeSPar.size() != 3 || apeRPar.size() != 3)
208  throw cms::Exception("BadConfig") << "apeSPar and apeRPar must have 3 values each" << std::endl;
209 
210  for (std::vector<double>::const_iterator i = apeRPar.begin(); i != apeRPar.end(); ++i) {
211  apeSPar.push_back(*i);
212  }
213 
214  if (function == std::string("linear")) {
215  apeSPar.push_back(0.); // c.f. note in calcAPE
216  }
217  else if (function == std::string("exponential")) {
218  apeSPar.push_back(1.); // c.f. note in calcAPE
219  }
220  else if (function == std::string("step")) {
221  apeSPar.push_back(2.); // c.f. note in calcAPE
222  }
223  else {
224  throw cms::Exception("BadConfig") << "APE function must be \"linear\" or \"exponential\"." << std::endl;
225  }
226 
227  theAPEParameters.push_back(std::pair<std::vector<Alignable*>, std::vector<double> >(alignables, apeSPar));
228  }
229  }
230 }
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
AlignmentParameterStore * theAlignmentParameterStore
const EventID & eventID() const
Definition: IOVSyncValue.h:42
static AlignableObjectId commonObjectIdProvider(const AlignableObjectId &, const AlignableObjectId &)
std::vector< unsigned > theIOVrangeSet
std::vector< std::pair< std::vector< Alignable * >, std::vector< double > > > theAPEParameters
AlignableNavigator * theAlignableDetAccessor
const T & get() const
Definition: EventSetup.h:56
std::unique_ptr< AlignableObjectId > alignableObjectId_
std::vector< edm::ParameterSet > theAPEParameterSet
const std::vector< std::string > surveyResiduals_
tuple level
Definition: testEve_cfg.py:34
const IOVSyncValue & first() const
std::vector< align::StructureType > theLevels
std::vector< Alignable * > theAlignables
const align::Alignables & alignables(void) const
get all alignables
bool HIPAlignmentAlgorithm::processHit1D ( const AlignableDetOrUnitPtr alidet,
const Alignable ali,
const TrajectoryStateOnSurface tsos,
const TrackingRecHit hit,
double  hitwt 
)
private

Definition at line 458 of file HIPAlignmentAlgorithm.cc.

References HIPUserVariables::alichi2, Alignable::alignmentParameters(), HIPUserVariables::alindof, HIPUserVariables::jtve, HIPUserVariables::jtvj, TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPosition(), TrackingRecHit::localPositionError(), HIPUserVariables::nhit, LocalTrajectoryError::positionError(), AlignmentParameters::selectedDerivatives(), mathSSE::sqrt(), theMaxAllowedHitPull, AlignmentParameters::userVariables(), PV3DBase< T, PVType, FrameType >::x(), and LocalError::xx().

Referenced by run().

463 {
464  static const unsigned int hitDim = 1;
465 
466  // get trajectory impact point
467  LocalPoint alvec = tsos.localPosition();
468  AlgebraicVector pos(hitDim);
469  pos[0] = alvec.x();
470 
471 // CY: get trajectory impact angle
472 // LocalVector v = tsos.localDirection();
473 // double proj_z = v.dot(LocalVector(0,0,1));
474 // edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit1D]detectorId="<<ali->id();
475 // edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit1D]proj_Z="<<proj_z;
476 
477  // get impact point covariance
478  AlgebraicSymMatrix ipcovmat(hitDim);
479  ipcovmat[0][0] = tsos.localError().positionError().xx();
480 
481  // get hit local position and covariance
482  AlgebraicVector coor(hitDim);
483  coor[0] = hit->localPosition().x();
484 
485  AlgebraicSymMatrix covmat(hitDim);
486  covmat[0][0] = hit->localPositionError().xx();
487 
488  // add hit and impact point covariance matrices
489  covmat = covmat + ipcovmat;
490 
491  // calculate the x pull of this hit
492  double xpull = 0.;
493  if (covmat[0][0] != 0.) xpull = (pos[0] - coor[0])/sqrt(fabs(covmat[0][0]));
494 
495  // get Alignment Parameters
496  AlignmentParameters* params = ali->alignmentParameters();
497  // get derivatives
498  AlgebraicMatrix derivs2D = params->selectedDerivatives(tsos, alidet);
499  // calculate user parameters
500  int npar = derivs2D.num_row();
501  AlgebraicMatrix derivs(npar, hitDim, 0);
502 
503  for (int ipar=0;ipar<npar;ipar++) {
504  for (unsigned int idim=0;idim<hitDim;idim++) {
505  derivs[ipar][idim] = derivs2D[ipar][idim];
506  }
507  }
508  // invert covariance matrix
509  int ierr;
510  // if (covmat[1][1]>4.0) nhitDim = hitDim;
511 
512  covmat.invert(ierr);
513  if (ierr != 0) {
514  edm::LogError("Alignment") << "Matrix inversion failed!";
515  return false;
516  }
517 
518  bool useThisHit = (theMaxAllowedHitPull <= 0.);
519 
520  useThisHit |= (fabs(xpull) < theMaxAllowedHitPull);
521 
522  // bailing out
523  if (!useThisHit) return false;
524 
525  // << derivs.num_row() << " x " << derivs.num_col() << std::endl;
526 
527  // AlgebraicMatrix jtvjtmp();
528  AlgebraicMatrix covtmp(covmat);
529  AlgebraicMatrix jtvjtmp(derivs * covtmp *derivs.T());
530  AlgebraicSymMatrix thisjtvj(npar);
531  AlgebraicVector thisjtve(npar);
532  // thisjtvj = covmat.similarity(derivs);
533  thisjtvj.assign(jtvjtmp);
534  thisjtve=derivs * covmat * (pos-coor);
535 
536  AlgebraicVector hitresidual(hitDim);
537  hitresidual[0] = (pos[0] - coor[0]);
538 
539  AlgebraicMatrix hitresidualT;
540  hitresidualT = hitresidual.T();
541 
542  // access user variables (via AlignmentParameters)
543  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(params->userVariables());
544 
545  uservar->jtvj += hitwt*thisjtvj;
546  uservar->jtve += hitwt*thisjtve;
547  uservar->nhit++;
548  // The following variable is needed for the extended 1D/2D hit fix using
549  // matrix shrinkage and expansion
550  // uservar->hitdim = hitDim;
551 
552  //for alignable chi squared
553  float thischi2;
554  thischi2 = hitwt*(hitresidualT *covmat *hitresidual)[0];
555 
556  if ( verbose && ((thischi2/ static_cast<float>(uservar->nhit)) >10.0) ) {
557  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit1D]Added to Chi2 the number " << thischi2 <<" having "
558  << uservar->nhit << " dof " << std::endl << "X-resid "
559  << hitresidual[0] << " Y-resid "
560  << hitresidual[1] << std::endl << " Cov^-1 matr (covmat): [0][0]= "
561  << covmat[0][0] << " [0][1]= "
562  << covmat[0][1] << " [1][0]= "
563  << covmat[1][0] << " [1][1]= "
564  << covmat[1][1] << std::endl;
565  }
566 
567  uservar->alichi2 += thischi2; // a bit weird, but vector.transposed * matrix * vector doesn't give a double in CMSSW's opinion
568  uservar->alindof += hitDim; // 2D hits contribute twice to the ndofs
569 
570  return true;
571 }
float xx() const
Definition: LocalError.h:24
AlgebraicVector jtve
LocalError positionError() const
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
AlgebraicSymMatrix jtvj
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
CLHEP::HepMatrix AlgebraicMatrix
T sqrt(T t)
Definition: SSEVec.h:18
const LocalTrajectoryError & localError() const
CLHEP::HepVector AlgebraicVector
virtual LocalError localPositionError() const =0
CLHEP::HepSymMatrix AlgebraicSymMatrix
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
virtual AlgebraicMatrix selectedDerivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
bool HIPAlignmentAlgorithm::processHit2D ( const AlignableDetOrUnitPtr alidet,
const Alignable ali,
const TrajectoryStateOnSurface tsos,
const TrackingRecHit hit,
double  hitwt 
)
private

Definition at line 573 of file HIPAlignmentAlgorithm.cc.

References HIPUserVariables::alichi2, Alignable::alignmentParameters(), HIPUserVariables::alindof, HIPUserVariables::jtve, HIPUserVariables::jtvj, TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPosition(), TrackingRecHit::localPositionError(), HIPUserVariables::nhit, LocalTrajectoryError::positionError(), AlignmentParameters::selectedDerivatives(), mathSSE::sqrt(), theMaxAllowedHitPull, AlignmentParameters::userVariables(), PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by run().

578 {
579  static const unsigned int hitDim = 2;
580 
581  // get trajectory impact point
582  LocalPoint alvec = tsos.localPosition();
583  AlgebraicVector pos(hitDim);
584  pos[0] = alvec.x();
585  pos[1] = alvec.y();
586 
587 // CY: get trajectory impact angle
588 // LocalVector v = tsos.localDirection();
589 // double proj_z = v.dot(LocalVector(0,0,1));
590 // edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit2D]detectorId="<<ali->id();
591 // edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit2D]proj_Z="<<proj_z;
592 
593  // get impact point covariance
594  AlgebraicSymMatrix ipcovmat(hitDim);
595  ipcovmat[0][0] = tsos.localError().positionError().xx();
596  ipcovmat[1][1] = tsos.localError().positionError().yy();
597  ipcovmat[0][1] = tsos.localError().positionError().xy();
598 
599  // get hit local position and covariance
600  AlgebraicVector coor(hitDim);
601  coor[0] = hit->localPosition().x();
602  coor[1] = hit->localPosition().y();
603 
604  AlgebraicSymMatrix covmat(hitDim);
605  covmat[0][0] = hit->localPositionError().xx();
606  covmat[1][1] = hit->localPositionError().yy();
607  covmat[0][1] = hit->localPositionError().xy();
608 
609  // add hit and impact point covariance matrices
610  covmat = covmat + ipcovmat;
611 
612  // calculate the x pull and y pull of this hit
613  double xpull = 0.;
614  double ypull = 0.;
615  if (covmat[0][0] != 0.) xpull = (pos[0] - coor[0])/sqrt(fabs(covmat[0][0]));
616  if (covmat[1][1] != 0.) ypull = (pos[1] - coor[1])/sqrt(fabs(covmat[1][1]));
617 
618  // get Alignment Parameters
619  AlignmentParameters* params = ali->alignmentParameters();
620  // get derivatives
621  AlgebraicMatrix derivs2D = params->selectedDerivatives(tsos, alidet);
622  // calculate user parameters
623  int npar = derivs2D.num_row();
624  AlgebraicMatrix derivs(npar, hitDim, 0);
625 
626  for (int ipar=0;ipar<npar;ipar++) {
627  for (unsigned int idim=0;idim<hitDim;idim++) {
628  derivs[ipar][idim] = derivs2D[ipar][idim];
629  }
630  }
631  // invert covariance matrix
632  int ierr;
633  // if (covmat[1][1]>4.0) nhitDim = hitDim;
634 
635  covmat.invert(ierr);
636  if (ierr != 0) {
637  edm::LogError("Alignment") << "Matrix inversion failed!";
638  return false;
639  }
640 
641  bool useThisHit = (theMaxAllowedHitPull <= 0.);
642 
643  useThisHit |= (fabs(xpull) < theMaxAllowedHitPull && fabs(ypull) < theMaxAllowedHitPull);
644 
645  // bailing out
646  if (!useThisHit) return false;
647 
648  // << derivs.num_row() << " x " << derivs.num_col() << std::endl;
649 
650  // AlgebraicMatrix jtvjtmp();
651  AlgebraicMatrix covtmp(covmat);
652  AlgebraicMatrix jtvjtmp(derivs * covtmp *derivs.T());
653  AlgebraicSymMatrix thisjtvj(npar);
654  AlgebraicVector thisjtve(npar);
655  // thisjtvj = covmat.similarity(derivs);
656  thisjtvj.assign(jtvjtmp);
657  thisjtve=derivs * covmat * (pos-coor);
658 
659  AlgebraicVector hitresidual(hitDim);
660  hitresidual[0] = (pos[0] - coor[0]);
661  hitresidual[1] = (pos[1] - coor[1]);
662  // if(nhitDim>1) {
663  // hitresidual[1] =0.0;
664  // nhitDim=1;
665  // }
666 
667  AlgebraicMatrix hitresidualT;
668  hitresidualT = hitresidual.T();
669  // access user variables (via AlignmentParameters)
670  HIPUserVariables* uservar = dynamic_cast<HIPUserVariables*>(params->userVariables());
671 
672  uservar->jtvj += hitwt*thisjtvj;
673  uservar->jtve += hitwt*thisjtve;
674  uservar->nhit++;
675  // The following variable is needed for the extended 1D/2D hit fix using
676  // matrix shrinkage and expansion
677  // uservar->hitdim = hitDim;
678 
679  //for alignable chi squared
680  float thischi2;
681  thischi2 = hitwt*(hitresidualT *covmat *hitresidual)[0];
682 
683  if ( verbose && ((thischi2/ static_cast<float>(uservar->nhit)) >10.0) ) {
684  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::processHit2D]Added to Chi2 the number " << thischi2 <<" having "
685  << uservar->nhit << " dof " << std::endl << "X-resid "
686  << hitresidual[0] << " Y-resid "
687  << hitresidual[1] << std::endl << " Cov^-1 matr (covmat): [0][0]= "
688  << covmat[0][0] << " [0][1]= "
689  << covmat[0][1] << " [1][0]= "
690  << covmat[1][0] << " [1][1]= "
691  << covmat[1][1] << std::endl;
692  }
693 
694  uservar->alichi2 += thischi2; // a bit weird, but vector.transposed * matrix * vector doesn't give a double in CMSSW's opinion
695  uservar->alindof += hitDim; // 2D hits contribute twice to the ndofs
696 
697  return true;
698 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV3DBase.h:63
AlgebraicVector jtve
LocalError positionError() const
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
AlgebraicSymMatrix jtvj
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
float xy() const
Definition: LocalError.h:25
CLHEP::HepMatrix AlgebraicMatrix
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:18
const LocalTrajectoryError & localError() const
CLHEP::HepVector AlgebraicVector
virtual LocalError localPositionError() const =0
CLHEP::HepSymMatrix AlgebraicSymMatrix
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
virtual AlgebraicMatrix selectedDerivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &alidet) const
int HIPAlignmentAlgorithm::readIterationFile ( std::string  filename)
private

Definition at line 968 of file HIPAlignmentAlgorithm.cc.

References recoMuon::in, and mps_fire::result.

Referenced by startNewLoop().

969 {
970  int result;
971 
972  std::ifstream inIterFile(filename.c_str(), std::ios::in);
973  if (!inIterFile) {
974  edm::LogError("Alignment") << "[HIPAlignmentAlgorithm::readIterationFile] ERROR! "
975  << "Unable to open Iteration file";
976  result = -1;
977  }
978  else {
979  inIterFile >> result;
980  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::readIterationFile] "
981  << "Read last iteration number from file: " << result;
982  }
983  inIterFile.close();
984 
985  return result;
986 }
tuple result
Definition: mps_fire.py:84
tuple filename
Definition: lut2db_cfg.py:20
void HIPAlignmentAlgorithm::run ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
virtual

Run the algorithm.

Implements AlignmentAlgorithmBase.

Definition at line 701 of file HIPAlignmentAlgorithm.cc.

References Abs(), CompositeAlignmentParameters::alignableFromAlignableDet(), AlignableNavigator::alignableFromGeomDet(), AlignableNavigator::alignablesFromHits(), angle(), TrajectoryMeasurement::backwardPredictedState(), chi2n, className(), SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), AlignmentAlgorithmBase::EventInfo::clusterValueMap(), col_cut, TrajectoryStateCombiner::combine(), cos_cut, reco::TrackBase::d0(), AlignableNavigator::detAndSubdetInMap(), reco::TrackBase::dz(), eta, reco::TrackBase::eta(), TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), TrackingRecHit::hit(), reco::TrackBase::hitPattern(), hitTree, Alignable::id(), isCollector, IsCollision, AlignmentClusterFlag::isTaken(), TrajectoryStateOnSurface::isValid(), TrackingRecHit::isValid(), TrajectoryStateOnSurface::localDirection(), m_angle, m_Chi2n, m_d0, m_detId, m_dz, m_Eta, m_hitwt, m_Nhits, m_nhPXB, m_nhPXF, m_nhTEC, m_nhTIB, m_nhTID, m_nhTOB, m_Ntracks, m_P, m_Phi, m_Pt, m_sinTheta, m_wt, MAXREC, Trajectory::measurements(), reco::TrackBase::normalizedChi2(), reco::TrackBase::numberOfValidHits(), reco::HitPattern::numberOfValidPixelBarrelHits(), reco::HitPattern::numberOfValidPixelEndcapHits(), reco::HitPattern::numberOfValidStripTECHits(), reco::HitPattern::numberOfValidStripTIBHits(), reco::HitPattern::numberOfValidStripTIDHits(), reco::HitPattern::numberOfValidStripTOBHits(), AlCaHLTBitMon_ParallelJobs::p, reco::TrackBase::p(), phi, reco::TrackBase::phi(), funct::pow(), processHit1D(), processHit2D(), EnergyCorrector::pt, reco::TrackBase::pt(), alignCSCRings::r, TrajectoryMeasurement::recHit(), Scale, AlignmentParameterStore::selectParameters(), mathSSE::sqrt(), DetId::subdetId(), theAlignableDetAccessor, theAlignmentParameterStore, theCurrentPrescale, theEventPrescale, theFillTrackMonitoring, theTree, trackPs, testEve_cfg::tracks, trackWt, AlignmentAlgorithmBase::EventInfo::trajTrackPairs(), uniEta, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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

702 {
703  if (isCollector) return;
704 
705  TrajectoryStateCombiner tsoscomb;
706 
707  // AM: not really needed
708  // AM: m_Ntracks = 0 should be sufficient
709  int itr=0;
710  m_Ntracks=0;
711 //CY : hit info
712  m_sinTheta =0;
713  m_angle = 0;
714  m_detId =0;
715  m_hitwt=1;
716 
717  // AM: what is this needed for?
718  //theFile->cd();
719 
720  // loop over tracks
722  for (ConstTrajTrackPairCollection::const_iterator it=tracks.begin();
723  it!=tracks.end();
724  ++it) {
725 
726 //CY: pre-selection
727 
728  const Trajectory* traj = (*it).first;
729  const reco::Track* track = (*it).second;
730 
731  float pt = track->pt();
732  float eta = track->eta();
733  float phi = track->phi();
734  float p = track->p();
735  float chi2n = track->normalizedChi2();
736  int nhit = track->numberOfValidHits();
737  float d0 = track->d0();
738  float dz = track->dz();
739 
740  int nhpxb = track->hitPattern().numberOfValidPixelBarrelHits();
741  int nhpxf = track->hitPattern().numberOfValidPixelEndcapHits();
742  int nhtib = track->hitPattern().numberOfValidStripTIBHits();
743  int nhtob = track->hitPattern().numberOfValidStripTOBHits();
744  int nhtid = track->hitPattern().numberOfValidStripTIDHits();
745  int nhtec = track->hitPattern().numberOfValidStripTECHits();
746 
747  if (verbose) edm::LogInfo("Alignment") << "New track pt,eta,phi,chi2n,hits: "
748  << pt << ","
749  << eta << ","
750  << phi << ","
751  << chi2n << ","
752  << nhit;
753 
754 //CY: Pre-selection
755 
756  double ihitwt = 1;
757  double trkwt = 1;
758  //eta distribution from 2015 RunD, need to change formula for other runs
759  TFormula *my_formula = new TFormula("formula","2.51469/(2.51469+4.11684*x-16.7847*pow(x,2)+46.1574*pow(x,3)-55.22*pow(x,4)+29.5591*pow(x,5)-5.39816*pow(x,6))");
760  if(uniEta){
761  trkwt = Scale*(my_formula->Eval(fabs(eta)));}
762  else trkwt=Scale;
763 
764  if (trackPs){
765  double r = gRandom->Rndm();
766  if (trkwt < r){
767  //edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::run]skip event, eta ="<<eta;
768  continue ;}
769  }
770  else if (trackWt){ihitwt=trkwt;}
771 
772 
773  //edm::LogWarning("Alignment") << "UsingReweighting="<<trackWt<<",trkwt="<<trkwt<<",hitWt="<<ihitwt;
774 
775  // fill track parameters in root tree
776  if (itr<MAXREC) {
777  m_Nhits[itr]=nhit;
778  m_Pt[itr]=pt;
779  m_P[itr]=p;
780  m_Eta[itr]=eta;
781  m_Phi[itr]=phi;
782  m_Chi2n[itr]=chi2n;
783  m_nhPXB[itr]=nhpxb;
784  m_nhPXF[itr]=nhpxf;
785  m_nhTIB[itr]=nhtib;
786  m_nhTOB[itr]=nhtob;
787  m_nhTID[itr]=nhtid;
788  m_nhTEC[itr]=nhtec;
789  m_d0[itr]=d0;
790  m_dz[itr]=dz;
791  m_wt[itr]=ihitwt;
792  itr++;
793  m_Ntracks=itr;
794  }
795  // AM: Can be simplified
796 
797  std::vector<const TransientTrackingRecHit*> hitvec;
798  std::vector<TrajectoryStateOnSurface> tsosvec;
799 
800  // loop over measurements
801  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
802  for (std::vector<TrajectoryMeasurement>::iterator im=measurements.begin();
803  im!=measurements.end();
804  ++im) {
805 
806  TrajectoryMeasurement meas = *im;
807 
808  // const TransientTrackingRecHit* ttrhit = &(*meas.recHit());
809  // const TrackingRecHit *hit = ttrhit->hit();
810  const TransientTrackingRecHit* hit = &(*meas.recHit());
811 
813 
814  // this is the updated state (including the current hit)
815  // TrajectoryStateOnSurface tsos=meas.updatedState();
816  // combine fwd and bwd predicted state to get state
817  // which excludes current hit
818 
820  if (eventInfo.clusterValueMap()) {
821  // check from the PrescalingMap if the hit was taken.
822  // If not skip to the next TM
823  // bool hitTaken=false;
824  AlignmentClusterFlag myflag;
825 
826  int subDet = hit->geographicalId().subdetId();
827  //take the actual RecHit out of the Transient one
828  const TrackingRecHit *rechit=hit->hit();
829  if (subDet>2) { // AM: if possible use enum instead of hard-coded value
830  const std::type_info &type = typeid(*rechit);
831 
832  if (type == typeid(SiStripRecHit1D)) {
833 
834  const SiStripRecHit1D* stripHit1D = dynamic_cast<const SiStripRecHit1D*>(rechit);
835  if (stripHit1D) {
836  SiStripRecHit1D::ClusterRef stripclust(stripHit1D->cluster());
837  // myflag=PrescMap[stripclust];
838  myflag = (*eventInfo.clusterValueMap())[stripclust];
839  } else {
840  edm::LogError("HIPAlignmentAlgorithm")
841  << "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Strip RecHit failed! "
842  << "TypeId of the RecHit: " << className(*hit) <<std::endl;
843  }
844 
845  }//end if type = SiStripRecHit1D
846  else if(type == typeid(SiStripRecHit2D)){
847 
848  const SiStripRecHit2D* stripHit2D = dynamic_cast<const SiStripRecHit2D*>(rechit);
849  if (stripHit2D) {
850  SiStripRecHit2D::ClusterRef stripclust(stripHit2D->cluster());
851  // myflag=PrescMap[stripclust];
852  myflag = (*eventInfo.clusterValueMap())[stripclust];
853  } else {
854  edm::LogError("HIPAlignmentAlgorithm")
855  << "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Strip RecHit failed! "
856  // << "TypeId of the TTRH: " << className(*ttrhit) << std::endl;
857  << "TypeId of the TTRH: " << className(*hit) << std::endl;
858  }
859  } //end if type == SiStripRecHit2D
860  } //end if hit from strips
861  else {
862  const SiPixelRecHit* pixelhit= dynamic_cast<const SiPixelRecHit*>(rechit);
863  if (pixelhit) {
864  SiPixelClusterRefNew pixelclust(pixelhit->cluster());
865  // myflag=PrescMap[pixelclust];
866  myflag = (*eventInfo.clusterValueMap())[pixelclust];
867  }
868  else {
869  edm::LogError("HIPAlignmentAlgorithm")
870  << "ERROR in <HIPAlignmentAlgorithm::run>: Dynamic cast of Pixel RecHit failed! "
871  // << "TypeId of the TTRH: " << className(*ttrhit) << std::endl;
872  << "TypeId of the TTRH: " << className(*hit) << std::endl;
873  }
874  } //end 'else' it is a pixel hit
875  // bool hitTaken=myflag.isTaken();
876  if (!myflag.isTaken()) {
877  continue;
878  }
879  }//end if Prescaled Hits
881 
883  meas.backwardPredictedState());
884 
885  if(tsos.isValid()){
886  // hitvec.push_back(ttrhit);
887  hitvec.push_back(hit);
888  tsosvec.push_back(tsos);
889  }
890 
891  } //hit valid
892  }
893 
894  // transform RecHit vector to AlignableDet vector
895  std::vector <AlignableDetOrUnitPtr> alidetvec = theAlignableDetAccessor->alignablesFromHits(hitvec);
896 
897  // get concatenated alignment parameters for list of alignables
899 
900  std::vector<TrajectoryStateOnSurface>::const_iterator itsos=tsosvec.begin();
901  std::vector<const TransientTrackingRecHit*>::const_iterator ihit=hitvec.begin();
902 
903  // loop over vectors(hit,tsos)
904  while (itsos != tsosvec.end()) {
905 
906  // get AlignableDet for this hit
907  const GeomDet* det = (*ihit)->det();
908  // int subDet= (*ihit)->geographicalId().subdetId();
909  uint32_t nhitDim = (*ihit)->dimension();
910 
912 
913  // get relevant Alignable
914  Alignable* ali = aap.alignableFromAlignableDet(alidet);
915 
916  if (ali!=0) {
917 
918  const TrajectoryStateOnSurface & tsos=*itsos;
919 
920 // LocalVector v = tsos.localDirection();
921 // double proj_z = v.dot(LocalVector(0,0,1));
922 
923 //In fact, sin_theta=Abs(mom_z)
924  double mom_x = tsos.localDirection().x();
925  double mom_y = tsos.localDirection().y();
926  double mom_z = tsos.localDirection().z();
927  double sin_theta = TMath::Abs(mom_z) / sqrt(pow(mom_x,2)+pow(mom_y,2)+pow(mom_z,2) );
928  double angle = TMath::ASin(sin_theta);
929 
930 
931 //Make cut on hit impact angle, reduce collision hits perpendicular to modules
932  if(IsCollision)
933  { if (angle>col_cut)ihitwt=0;}
934  else
935  { if (angle<cos_cut)ihitwt=0;}
936  m_angle = angle;
937  m_sinTheta = sin_theta;
938  m_detId = ali->id();
939  m_hitwt = ihitwt;
940 
941  if (theFillTrackMonitoring) hitTree->Fill();
942 
943  if ((nhitDim==1)&&(ihitwt!=0)) {
944  processHit1D(alidet, ali, *itsos, *ihit, ihitwt);
945  } else if ((nhitDim==2)&&(ihitwt!=0)) {
946  processHit2D(alidet, ali, *itsos, *ihit, ihitwt);
947  }
948  }
949 
950  itsos++;
951  ihit++;
952  }
953  } // end of track loop
954 
955  // fill eventwise root tree (with prescale defined in pset)
958  //edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::run] theCurrentPrescale="<<theCurrentPrescale;
959  if (theCurrentPrescale<=0) {
960  theTree->Fill();
962  }
963  }
964 }
ClusterRef cluster() const
double p() const
momentum vector magnitude
Definition: TrackBase.h:610
type
Definition: HCALResponse.h:21
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:185
ConstRecHitPointer const & recHit() const
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:592
AlignableDetOrUnitPtr alignableFromGeomDet(const GeomDet *geomDet)
Returns AlignableDetOrUnitPtr corresponding to given GeomDet.
AlignmentParameterStore * theAlignmentParameterStore
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:556
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
LocalVector localDirection() const
T y() const
Definition: PV3DBase.h:63
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:640
Alignable * alignableFromAlignableDet(const AlignableDetOrUnitPtr &adet) const
Get relevant Alignable from AlignableDet.
int numberOfValidStripTOBHits() const
Definition: HitPattern.h:868
const ConstTrajTrackPairCollection & trajTrackPairs() const
bool processHit1D(const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
DataContainer const & measurements() const
Definition: Trajectory.h:196
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:843
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:616
T z() const
Definition: PV3DBase.h:64
T Abs(T a)
Definition: MathUtil.h:49
AlignableNavigator * theAlignableDetAccessor
int numberOfValidStripTIDHits() const
Definition: HitPattern.h:863
ClusterRef cluster() const
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:815
int numberOfValidStripTECHits() const
Definition: HitPattern.h:873
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:604
virtual TrackingRecHit const * hit() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:445
tuple tracks
Definition: testEve_cfg.py:39
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
CompositeAlignmentParameters selectParameters(const std::vector< AlignableDet * > &alignabledets) const
bool isValid() const
bool processHit2D(const AlignableDetOrUnitPtr &alidet, const Alignable *ali, const TrajectoryStateOnSurface &tsos, const TrackingRecHit *hit, double hitwt)
int numberOfValidStripTIBHits() const
Definition: HitPattern.h:858
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:848
std::vector< AlignableDetOrUnitPtr > alignablesFromHits(const std::vector< const TransientTrackingRecHit * > &hitvec)
Returns vector AlignableDetOrUnitPtr for given vector of Hits.
const AliClusterValueMap * clusterValueMap() const
DetId geographicalId() const
bool detAndSubdetInMap(const DetId &detid) const
Given a DetId, returns true if DetIds with this detector and subdetector id are in the map (not neces...
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
std::string className(const T &t)
Definition: ClassName.h:30
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Our base class.
Definition: SiPixelRecHit.h:23
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void HIPAlignmentAlgorithm::setAlignmentPositionError ( void  )
private

Definition at line 1007 of file HIPAlignmentAlgorithm.cc.

References calcAPE(), i, AlignmentParameterStore::setAlignmentPositionError(), theAlignmentParameterStore, theAPEParameters, theApplyAPE, and theIteration.

Referenced by startNewLoop().

1008 {
1009 
1010 
1011  // Check if user wants to override APE
1012  if ( !theApplyAPE )
1013  {
1014  edm::LogWarning("Alignment") <<"[HIPAlignmentAlgorithm::setAlignmentPositionError] No APE applied";
1015  return; // NO APE APPLIED
1016  }
1017 
1018 
1019  edm::LogWarning("Alignment") <<"[HIPAlignmentAlgorithm::setAlignmentPositionError] Apply APE!";
1020 
1021  double apeSPar[3], apeRPar[3];
1022  for (std::vector<std::pair<std::vector<Alignable*>, std::vector<double> > >::const_iterator alipars = theAPEParameters.begin();
1023  alipars != theAPEParameters.end();
1024  ++alipars) {
1025  const std::vector<Alignable*> &alignables = alipars->first;
1026  const std::vector<double> &pars = alipars->second;
1027 
1028  apeSPar[0] = pars[0];
1029  apeSPar[1] = pars[1];
1030  apeSPar[2] = pars[2];
1031  apeRPar[0] = pars[3];
1032  apeRPar[1] = pars[4];
1033  apeRPar[2] = pars[5];
1034 
1035  double function = pars[6];
1036 
1037  // Printout for debug
1038  printf("APE: %u alignables\n", (unsigned int)alignables.size());
1039  for ( int i=0; i<21; ++i ) {
1040  double apelinstest=calcAPE(apeSPar,i,0.);
1041  double apeexpstest=calcAPE(apeSPar,i,1.);
1042  double apestepstest=calcAPE(apeSPar,i,2.);
1043  double apelinrtest=calcAPE(apeRPar,i,0.);
1044  double apeexprtest=calcAPE(apeRPar,i,1.);
1045  double apesteprtest=calcAPE(apeRPar,i,2.);
1046  printf("APE: iter slin sexp sstep rlin rexp rstep: %5d %12.5f %12.5f %12.5f %12.5f %12.5f %12.5f \n",
1047  i,apelinstest,apeexpstest,apestepstest, apelinrtest,apeexprtest,apesteprtest);
1048  }
1049 
1050  // set APE
1051  double apeshift=calcAPE(apeSPar,theIteration,function);
1052  double aperot =calcAPE(apeRPar,theIteration,function);
1053  theAlignmentParameterStore->setAlignmentPositionError( alignables, apeshift, aperot );
1054  }
1055 
1056 }
int i
Definition: DBlmapReader.cc:9
AlignmentParameterStore * theAlignmentParameterStore
void setAlignmentPositionError(const align::Alignables &alivec, double valshift, double valrot)
Set Alignment position error.
std::vector< std::pair< std::vector< Alignable * >, std::vector< double > > > theAPEParameters
double calcAPE(double *par, int iter, double function)
void HIPAlignmentAlgorithm::startNewLoop ( void  )
virtual

Called at start of new loop.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 233 of file HIPAlignmentAlgorithm.cc.

References AlignmentParameterStore::applyAlignableAbsolutePositions(), bookRoot(), collector(), ioerr, isCollector, AlignmentParameters::numSelected(), AlignmentIORoot::readAlignableAbsolutePositions(), readIterationFile(), salignedfile, setAlignmentPositionError(), AlignmentParameters::setUserVariables(), siterationfile, theAlignables, theAlignmentParameterStore, theIO, and theIteration.

234 {
235 
236  // iterate over all alignables and attach user variables
237  for( std::vector<Alignable*>::const_iterator it=theAlignables.begin();
238  it!=theAlignables.end(); it++ )
239  {
240  AlignmentParameters* ap = (*it)->alignmentParameters();
241  int npar=ap->numSelected();
242  HIPUserVariables* userpar = new HIPUserVariables(npar);
243  ap->setUserVariables(userpar);
244  }
245 
246  // try to read in alignment parameters from a previous iteration
247  //
248  AlignablePositions theAlignablePositionsFromFile =
250  salignedfile.c_str(),-1,ioerr);
251 
252  int numAlignablesFromFile = theAlignablePositionsFromFile.size();
253 
254  if (numAlignablesFromFile==0) { // file not there: first iteration
255 
256  // set iteration number to 1
257  if (isCollector) theIteration=0;
258  else theIteration=1;
259  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] File not found => iteration "<<theIteration;
260 
261  // get true (de-misaligned positions) and write to root file
262  // hardcoded iteration=1
263 // theIO.writeAlignableOriginalPositions(theAlignables,
264 // struefile.c_str(),1,false,ioerr);
265 
266  // get misaligned positions and write to root file
267  // hardcoded iteration=1
268 // theIO.writeAlignableAbsolutePositions(theAlignables,
269 // smisalignedfile.c_str(),1,false,ioerr);
270 
271  }
272 
273  else { // there have been previous iterations
274 
275  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Alignables Read "
276  << numAlignablesFromFile;
277 
278  // get iteration number from file
282 
283  // increase iteration
284  if(ioerr==0){
285  theIteration++;
286  edm::LogWarning("Alignment") <<"[HIPAlignmentAlgorithm] Iteration increased by one!";
287  }
288 
289  // now apply psotions of file from prev iteration
290  edm::LogInfo("Alignment") <<"[HIPAlignmentAlgorithm] Apply positions from file ...";
292  theAlignablePositionsFromFile,ioerr);
293 
294  }
295 
296  edm::LogWarning("Alignment") <<"[HIPAlignmentAlgorithm] Current Iteration number: "
297  << theIteration;
298 
299 
300  // book root trees
301  bookRoot();
302 
303  // set alignment position error
305 
306  // run collector job if we are in parallel mode
307  if (isCollector) collector();
308 
309 }
AlignmentParameterStore * theAlignmentParameterStore
void applyAlignableAbsolutePositions(const align::Alignables &alis, const AlignablePositions &newpos, int &ierr)
apply absolute positions to alignables
AlignablePositions readAlignableAbsolutePositions(const align::Alignables &alivec, const char *filename, int iter, int &ierr)
read Alignable current absolute positions
int readIterationFile(std::string filename)
int numSelected(void) const
Get number of selected parameters.
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
std::vector< AlignableAbsData > AlignablePositions
Definition: AlignableData.h:51
std::vector< Alignable * > theAlignables
void HIPAlignmentAlgorithm::terminate ( const edm::EventSetup setup)
virtual

Call at end of job.

Implements AlignmentAlgorithmBase.

Definition at line 313 of file HIPAlignmentAlgorithm.cc.

References Alignable::alignmentParameters(), AlignmentParameterStore::applyParameters(), calcParameters(), fillRoot(), edm::EventSetup::get(), hitTree, i, Alignable::id(), SurveyResidual::inverseCovariance(), ioerr, isCollector, HIPUserVariables::jtve, HIPUserVariables::jtvj, cmsLHEtoEOSManager::l, m3_Id, m3_ObjId, m3_par, HIPUserVariables::nhit, GloballyPositioned< T >::position(), edm::ESHandle< class >::product(), salignedfile, SurveyResidual::sensorResidual(), SetScanDet, AlignmentParameters::setValid(), siterationfile, Alignable::surface(), suvarfile, ctpps_dqm_sourceclient-live_cfg::test, theAlignables, theAlignmentParameterStore, theFile, theFile2, theFile3, theFillTrackMonitoring, theIO, theIteration, theLevels, theTree, theTree2, theTree3, AlignmentParameterStore::typeAndLayer(), AlignmentParameters::userVariables(), SurveyResidual::valid(), AlignmentIORoot::writeAlignableAbsolutePositions(), HIPUserVariablesIORoot::writeHIPUserVariables(), writeIterationFile(), and PV3DBase< T, PVType, FrameType >::z().

314 {
315 
316  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Terminating";
317 
318  // calculating survey residuals
319  if (theLevels.size() > 0 )
320  {
321  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Using survey constraint";
322 
323  unsigned int nAlignable = theAlignables.size();
324  edm::ESHandle<TrackerTopology> tTopoHandle;
325  iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
326  const TrackerTopology* const tTopo = tTopoHandle.product();
327  for (unsigned int i = 0; i < nAlignable; ++i)
328  {
329  const Alignable* ali = theAlignables[i];
330 
332 
333  HIPUserVariables* uservar =
334  dynamic_cast<HIPUserVariables*>(ap->userVariables());
335  int nhit = uservar->nhit;
336 
337  // get position
338  std::pair<int,int> tl = theAlignmentParameterStore->typeAndLayer(ali, tTopo);
339  int tmp_Type = tl.first;
340  int tmp_Layer = tl.second;
341  GlobalPoint pos = ali->surface().position();
342  float tmpz = pos.z();
343  if(nhit< 1500 || (tmp_Type==5 && tmp_Layer==4 && fabs(tmpz)>90)){
344  for (unsigned int l = 0; l < theLevels.size(); ++l)
345  {
346  SurveyResidual res(*ali, theLevels[l], true);
347 
348  if ( res.valid() )
349  {
350  AlgebraicSymMatrix invCov = res.inverseCovariance();
351 
352  // variable for tree
353  AlgebraicVector sensResid = res.sensorResidual();
354  m3_Id = ali->id();
355  m3_ObjId = theLevels[l];
356  m3_par[0] = sensResid[0]; m3_par[1] = sensResid[1]; m3_par[2] = sensResid[2];
357  m3_par[3] = sensResid[3]; m3_par[4] = sensResid[4]; m3_par[5] = sensResid[5];
358 
359  uservar->jtvj += invCov;
360  uservar->jtve += invCov * sensResid;
361 
362  theTree3->Fill();
363  }
364  }
365  }
366 
367  }
368  }
369 
370  // write user variables
372 
373  if(!isCollector) //don't store userVariable in main, to save time
375  theIteration,false,ioerr);
376 
377  // now calculate alignment corrections ...
378  int ialigned=0;
379  // iterate over alignment parameters
380  for(std::vector<Alignable*>::const_iterator
381  it=theAlignables.begin(); it!=theAlignables.end(); it++) {
382  Alignable* ali=(*it);
383  // Alignment parameters
385 
386 
387  if (SetScanDet.at(0)!=0){
388  edm::LogWarning("Alignment") << "********Starting Scan*********";
389  edm::LogWarning("Alignment") <<"det ID="<<SetScanDet.at(0)<<", starting position="<<SetScanDet.at(1)<<", step="<<SetScanDet.at(2)<<", currentDet = "<<ali->id();}
390 
391  if((SetScanDet.at(0)!=0)&&(SetScanDet.at(0)!=1)&&(ali->id()!=SetScanDet.at(0)))continue;
392 
393  bool test = calcParameters(ali,SetScanDet.at(0),SetScanDet.at(1),SetScanDet.at(2));
394  // if successful, apply parameters
395  if (test) {
396  edm::LogWarning("Alignment") << "now apply params";
398  // set these parameters 'valid'
399  ali->alignmentParameters()->setValid(true);
400  // increase counter
401  ialigned++;
402  }
403  else par->setValid(false);
404 // }
405 
406  }
407 //end looping over alignables
408 
409  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm::terminate] Aligned units: " << ialigned;
410 
411  // fill alignable wise root tree
412  fillRoot(iSetup);
413 
414  edm::LogWarning("Alignment") << "[HIPAlignmentAlgorithm] Writing aligned parameters to file: " << theAlignables.size()<<", for Iteration "<<theIteration;
415 
416 
417  // write user variables
418  if(isCollector)
420  theIteration,false,ioerr);
421 
422  // write new absolute positions to disk
424  salignedfile.c_str(),theIteration,false,ioerr);
425 
426  // write alignment parameters to disk
427  //theIO.writeAlignmentParameters(theAlignables,
428  // sparameterfile.c_str(),theIteration,false,ioerr);
429 
430  // write iteration number to file
432 
433  // write out trees and close root file
434 
435  // eventwise tree
437  theFile->cd();
438  theTree->Write();
439  hitTree->Write();
440  delete theFile;
441  }
442 
443  if (theLevels.size() > 0){
444  theFile3->cd();
445  theTree3->Write();
446  delete theFile3;
447  }
448 
449  // alignable-wise tree is only filled once
450  if (theIteration==1) { // only for 1st iteration
451  theFile2->cd();
452  theTree2->Write();
453  delete theFile2;
454  }
455 
456 }
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:185
int i
Definition: DBlmapReader.cc:9
AlignmentParameterStore * theAlignmentParameterStore
std::pair< int, int > typeAndLayer(const Alignable *ali, const TrackerTopology *tTopo) const
Obtain type and layer from Alignable.
void writeIterationFile(std::string filename, int iter)
void applyParameters(void)
Obsolete: Use AlignableNavigator::alignableDetFromDetId and alignableFromAlignableDet.
AlgebraicVector jtve
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:57
void writeHIPUserVariables(const Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr)
bool calcParameters(Alignable *ali, int setDet, double start, double step)
AlgebraicSymMatrix jtvj
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
void setValid(bool v)
Set validity flag.
T z() const
Definition: PV3DBase.h:64
void fillRoot(const edm::EventSetup &setup)
std::vector< double > SetScanDet
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
CLHEP::HepVector AlgebraicVector
T const * product() const
Definition: ESHandle.h:86
align::StructureType m3_ObjId
CLHEP::HepSymMatrix AlgebraicSymMatrix
void writeAlignableAbsolutePositions(const align::Alignables &alivec, const char *filename, int iter, bool validCheck, int &ierr)
write Alignable current absolute positions
const PositionType & position() const
std::vector< align::StructureType > theLevels
std::vector< Alignable * > theAlignables
void HIPAlignmentAlgorithm::writeIterationFile ( std::string  filename,
int  iter 
)
private

Definition at line 990 of file HIPAlignmentAlgorithm.cc.

References fileinputsource_cfi::out.

Referenced by terminate().

991 {
992  std::ofstream outIterFile((filename.c_str()), std::ios::out);
993  if (!outIterFile) {
994  edm::LogError("Alignment") << "[HIPAlignmentAlgorithm::writeIterationFile] ERROR: Unable to write Iteration file";
995  }
996  else {
997  outIterFile << iter;
998  edm::LogWarning("Alignment") <<"[HIPAlignmentAlgorithm::writeIterationFile] writing iteration number to file: " << iter;
999  }
1000  outIterFile.close();
1001 }
tuple filename
Definition: lut2db_cfg.py:20

Member Data Documentation

std::unique_ptr<AlignableObjectId> HIPAlignmentAlgorithm::alignableObjectId_
private

Definition at line 74 of file HIPAlignmentAlgorithm.h.

Referenced by initialize().

double HIPAlignmentAlgorithm::col_cut
private

Definition at line 109 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

double HIPAlignmentAlgorithm::cos_cut
private

Definition at line 109 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

TTree* HIPAlignmentAlgorithm::hitTree
private

Definition at line 119 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), run(), and terminate().

int HIPAlignmentAlgorithm::ioerr
private

Definition at line 80 of file HIPAlignmentAlgorithm.h.

Referenced by collector(), startNewLoop(), and terminate().

bool HIPAlignmentAlgorithm::isCollector
private
bool HIPAlignmentAlgorithm::IsCollision
private

Definition at line 108 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

float HIPAlignmentAlgorithm::m2_Eta
private

Definition at line 137 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

align::ID HIPAlignmentAlgorithm::m2_Id
private

Definition at line 138 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

int HIPAlignmentAlgorithm::m2_Layer
private

Definition at line 136 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

int HIPAlignmentAlgorithm::m2_Nhit
private

Definition at line 136 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

align::StructureType HIPAlignmentAlgorithm::m2_ObjId
private

Definition at line 139 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

float HIPAlignmentAlgorithm::m2_Phi
private

Definition at line 137 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

int HIPAlignmentAlgorithm::m2_Type
private

Definition at line 136 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

float HIPAlignmentAlgorithm::m2_Xpos
private

Definition at line 137 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

float HIPAlignmentAlgorithm::m2_Ypos
private

Definition at line 137 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

float HIPAlignmentAlgorithm::m2_Zpos
private

Definition at line 137 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and fillRoot().

align::ID HIPAlignmentAlgorithm::m3_Id
private

Definition at line 142 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and terminate().

align::StructureType HIPAlignmentAlgorithm::m3_ObjId
private

Definition at line 143 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and terminate().

float HIPAlignmentAlgorithm::m3_par[6]
private

Definition at line 144 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and terminate().

float HIPAlignmentAlgorithm::m_angle
private

Definition at line 132 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_Chi2n[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_d0[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

align::ID HIPAlignmentAlgorithm::m_detId
private

Definition at line 133 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_dz[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_Eta[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_hitwt
private

Definition at line 132 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_Nhits[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_nhPXB[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_nhPXF[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_nhTEC[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_nhTIB[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_nhTID[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_nhTOB[MAXREC]
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

int HIPAlignmentAlgorithm::m_Ntracks
private

Definition at line 128 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_P[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_Phi[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_Pt[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_sinTheta
private

Definition at line 132 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

float HIPAlignmentAlgorithm::m_wt[MAXREC]
private

Definition at line 129 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), and run().

const int HIPAlignmentAlgorithm::MAXREC = 99
staticprivate

Definition at line 126 of file HIPAlignmentAlgorithm.h.

Referenced by fillEventwiseTree(), and run().

std::string HIPAlignmentAlgorithm::outfile
private

Definition at line 88 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and HIPAlignmentAlgorithm().

std::string HIPAlignmentAlgorithm::outfile2
private

Definition at line 88 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), HIPAlignmentAlgorithm(), and initialize().

std::string HIPAlignmentAlgorithm::outpath
private

Definition at line 88 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm().

std::string HIPAlignmentAlgorithm::salignedfile
private

Definition at line 89 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), initialize(), startNewLoop(), and terminate().

double HIPAlignmentAlgorithm::Scale
private

Definition at line 109 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

std::vector<double> HIPAlignmentAlgorithm::SetScanDet
private

Definition at line 111 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and terminate().

std::string HIPAlignmentAlgorithm::siterationfile
private

Definition at line 89 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), initialize(), startNewLoop(), and terminate().

std::string HIPAlignmentAlgorithm::smisalignedfile
private

Definition at line 89 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm().

std::string HIPAlignmentAlgorithm::sparameterfile
private

Definition at line 88 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm().

std::string HIPAlignmentAlgorithm::ssurveyfile
private

Definition at line 89 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), HIPAlignmentAlgorithm(), and initialize().

std::string HIPAlignmentAlgorithm::struefile
private

Definition at line 89 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm().

const std::vector<std::string> HIPAlignmentAlgorithm::surveyResiduals_
private

Definition at line 113 of file HIPAlignmentAlgorithm.h.

Referenced by initialize().

std::string HIPAlignmentAlgorithm::suvarfile
private

Definition at line 88 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), initialize(), and terminate().

AlignableNavigator* HIPAlignmentAlgorithm::theAlignableDetAccessor
private

Definition at line 77 of file HIPAlignmentAlgorithm.h.

Referenced by initialize(), and run().

std::vector<Alignable*> HIPAlignmentAlgorithm::theAlignables
private

Definition at line 76 of file HIPAlignmentAlgorithm.h.

Referenced by collector(), fillRoot(), initialize(), startNewLoop(), and terminate().

AlignmentParameterStore* HIPAlignmentAlgorithm::theAlignmentParameterStore
private
std::vector<std::pair<std::vector<Alignable*>, std::vector<double> > > HIPAlignmentAlgorithm::theAPEParameters
private

Definition at line 96 of file HIPAlignmentAlgorithm.h.

Referenced by initialize(), and setAlignmentPositionError().

std::vector<edm::ParameterSet> HIPAlignmentAlgorithm::theAPEParameterSet
private

Definition at line 94 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and initialize().

bool HIPAlignmentAlgorithm::theApplyAPE
private
int HIPAlignmentAlgorithm::theCollectorNJobs
private

Definition at line 105 of file HIPAlignmentAlgorithm.h.

Referenced by collector(), and HIPAlignmentAlgorithm().

std::string HIPAlignmentAlgorithm::theCollectorPath
private

Definition at line 106 of file HIPAlignmentAlgorithm.h.

Referenced by collector(), and HIPAlignmentAlgorithm().

int HIPAlignmentAlgorithm::theCurrentPrescale
private

Definition at line 107 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

int HIPAlignmentAlgorithm::theEventPrescale
private

Definition at line 107 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

TFile* HIPAlignmentAlgorithm::theFile
private

Definition at line 117 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and terminate().

TFile* HIPAlignmentAlgorithm::theFile2
private

Definition at line 120 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillRoot(), and terminate().

TFile* HIPAlignmentAlgorithm::theFile3
private

Definition at line 122 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and terminate().

bool HIPAlignmentAlgorithm::theFillTrackMonitoring
private

Definition at line 110 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), collector(), HIPAlignmentAlgorithm(), run(), and terminate().

AlignmentIORoot HIPAlignmentAlgorithm::theIO
private

Definition at line 79 of file HIPAlignmentAlgorithm.h.

Referenced by startNewLoop(), and terminate().

std::vector<unsigned> HIPAlignmentAlgorithm::theIOVrangeSet
private

Definition at line 95 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and initialize().

int HIPAlignmentAlgorithm::theIteration
private
std::vector<align::StructureType> HIPAlignmentAlgorithm::theLevels
private

Definition at line 114 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), initialize(), and terminate().

double HIPAlignmentAlgorithm::theMaxAllowedHitPull
private

Definition at line 98 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), processHit1D(), and processHit2D().

double HIPAlignmentAlgorithm::theMaxRelParameterError
private

Definition at line 102 of file HIPAlignmentAlgorithm.h.

Referenced by calcParameters(), and HIPAlignmentAlgorithm().

int HIPAlignmentAlgorithm::theMinimumNumberOfHits
private

Definition at line 100 of file HIPAlignmentAlgorithm.h.

Referenced by calcParameters(), and HIPAlignmentAlgorithm().

bool HIPAlignmentAlgorithm::themultiIOV
private

Definition at line 93 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and initialize().

TTree* HIPAlignmentAlgorithm::theTree
private

Definition at line 118 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillEventwiseTree(), run(), and terminate().

TTree* HIPAlignmentAlgorithm::theTree2
private

Definition at line 121 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), fillRoot(), and terminate().

TTree* HIPAlignmentAlgorithm::theTree3
private

Definition at line 123 of file HIPAlignmentAlgorithm.h.

Referenced by bookRoot(), and terminate().

bool HIPAlignmentAlgorithm::trackPs
private

Definition at line 108 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

bool HIPAlignmentAlgorithm::trackWt
private

Definition at line 108 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

bool HIPAlignmentAlgorithm::uniEta
private

Definition at line 108 of file HIPAlignmentAlgorithm.h.

Referenced by HIPAlignmentAlgorithm(), and run().

bool HIPAlignmentAlgorithm::verbose
private