45 edm::LogInfo(
"Alignment") <<
"[MuonDTLocalMillepedeAlgorithm] constructed.";
66 if(workingmode == 0) {
67 edm::LogInfo(
"Alignment") <<
"[MuonDTLocalMillepedeAlgorithm] Running on production mode.";
69 snprintf(nameOfFile,
sizeof(nameOfFile),
"%s/MyNtupleResidual.root",
ntuplePath.c_str());
70 f =
new TFile(nameOfFile,
"RECREATE");
73 }
else if (workingmode == 1) {
74 edm::LogInfo(
"Alignment") <<
"[MuonDTLocalMillepedeAlgorithm] Running SLToSL algorithm.";
76 edm::LogInfo(
"Alignment") <<
"[MuonDTLocalMillepedeAlgorithm] Running Local Millepede algorithm.";
115 edm::LogInfo(
"Alignment") <<
"[MuonDTLocalMillepedeAlgorithm] Starting SLToSL algorithm";
118 edm::LogInfo(
"Alignment") <<
"[MuonDTLocalMillepedeAlgorithm] Starting local MuonMillepede algorithm";
140 for( ConstTrajTrackPairCollection::const_iterator it=tracks.begin();
141 it!=tracks.end();it++) {
153 if(pt < ptMin || pt >
ptMax)
continue;
155 vector<const TransientTrackingRecHit*> hitvec;
156 vector<TrajectoryMeasurement> measurements = traj->
measurements();
160 for (vector<TrajectoryMeasurement>::iterator im=measurements.begin();
161 im!=measurements.end(); im++) {
167 hitvec.push_back(hit);
174 vector<const TransientTrackingRecHit*>::const_iterator ihit=hitvec.begin();
178 while (ihit != hitvec.end())
180 const GeomDet* det=(*ihit)->det();
184 DTChamberId mChamber(mLayer.wheel(), mLayer.station(), mLayer.sector());
191 myTrack1D.
erx[ch_counter] = (*ihit)->localPositionError().xx();
216 bool saveThis =
false;
220 int numlayer[20][12];
221 for(
int s = 0;
s < 20; ++
s) {
222 for(
int k = 0;
k < 5; ++
k)
id[
s][
k] = 0;
223 for(
int k = 0;
k < 12; ++
k) numlayer[
s][
k] = 0;
230 for(
int counterCham = 0; counterCham < nChambers; counterCham++) {
235 id[counterCham][4]++;
237 id[counterCham][3]++;
239 for (
int ila = 1; ila<=4; ila++)
242 numlayer[counterCham][jla]++;
256 for (
int ila = 1; ila<=4; ila++)
259 numlayer[nChambers][jla]++;
267 xc[iseg][ihit] = -250.;
268 yc[iseg][ihit] = -250.;
269 zc[iseg][ihit] = -250.;
270 ex[iseg][ihit] = -250.;
271 xcp[iseg][ihit] = -250.;
272 ycp[iseg][ihit] = -250.;
273 excp[iseg][ihit] = -250.;
274 eycp[iseg][ihit] = -250.;
282 bool GoodPhiChamber =
true, GoodThetaChamber =
true;
283 for (
int ila = 1; ila<=12; ila++) {
284 if (numlayer[
counter][ila-1]!=1 && (ila<5 || ila>8)) GoodPhiChamber =
false;
285 if (numlayer[
counter][ila-1]!=1 && (ila<9 || ila>4) &&
id[
counter][1]!=4) GoodThetaChamber =
false;
289 GoodPhiChamber && GoodThetaChamber) {
291 TMatrixD phiProjection(2,2);
292 TMatrixD thetaProjection(2,2);
293 TMatrixD bphiProjection(2,1);
294 TMatrixD bthetaProjection(2,1);
296 TMatrixD phiProjectionSL1(2,2);
297 TMatrixD bphiProjectionSL1(2,1);
298 TMatrixD phiProjectionSL3(2,2);
299 TMatrixD bphiProjectionSL3(2,1);
304 int numh1 = 0, numh2 = 0, numh3 = 0;
349 if (phiProjection(0,0) != 0 && phiProjectionSL1(0,0) != 0 && phiProjectionSL3(0,0) != 0 &&
350 (thetaProjection(0,0) != 0 ||
id[
counter][1] == 4)) {
356 if(thetaProjection(0,0) != 0 &&
id[
counter][1] != 4) {
357 thetaProjection.Invert();
358 TMatrixD solution = thetaProjection*bthetaProjection;
365 phiProjection.Invert();
366 phiProjectionSL1.Invert();
367 phiProjectionSL3.Invert();
368 TMatrixD solution = phiProjection*bphiProjection;
369 TMatrixD solutionSL1 = phiProjectionSL1*bphiProjectionSL1;
370 TMatrixD solutionSL3 = phiProjectionSL3*bphiProjectionSL3;
381 xSL1SL3[
nseg] = solutionSL1(0,0) + SL3_z_ave * solutionSL1(1,0);
387 xSL3SL1[
nseg] = solutionSL3(0,0) + SL1_z_ave * solutionSL3(1,0);
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
float edydzSl[MAX_SEGMENT]
float yc[MAX_SEGMENT][MAX_HIT_CHAM]
ConstRecHitPointer const & recHit() const
float dydzSl[MAX_SEGMENT]
float excp[MAX_SEGMENT][MAX_HIT_CHAM]
int nthetahits[MAX_SEGMENT]
float dxdzSlSL1[MAX_SEGMENT]
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
float eydydzSl[MAX_SEGMENT]
double phi() const
azimuthal angle of momentum vector
std::vector< Alignable * > theAlignables
float exdxdzSlSL1[MAX_SEGMENT]
const ConstTrajTrackPairCollection & trajTrackPairs_
float xSlSL3[MAX_SEGMENT]
uint32_t rawId() const
get the raw id
float exSlSL1[MAX_SEGMENT]
DataContainer const & measurements() const
float xcp[MAX_SEGMENT][MAX_HIT_CHAM]
double eta() const
pseudorapidity of momentum vector
float dxdzSlSL3[MAX_SEGMENT]
float exdxdzSlSL3[MAX_SEGMENT]
const GeomDet * det() const
void initialize(const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignmentParameterStore *store)
Call at beginning of job.
float exdxdzSl[MAX_SEGMENT]
double pt() const
track transverse momentum
float ycp[MAX_SEGMENT][MAX_HIT_CHAM]
float zc[MAX_SEGMENT][MAX_HIT_CHAM]
DetId geographicalId() const
The label of this GeomDet.
MuonDTLocalMillepedeAlgorithm(const edm::ParameterSet &cfg)
Constructor.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
float xSL1SL3[MAX_SEGMENT]
int sl[MAX_SEGMENT][MAX_HIT_CHAM]
float dxdzSl[MAX_SEGMENT]
float exSlSL3[MAX_SEGMENT]
void run(const edm::EventSetup &setup, const EventInfo &eventInfo)
Run the algorithm on trajectories and tracks.
float edxdzSlSL1[MAX_SEGMENT]
static std::atomic< unsigned int > counter
float edxdzSlSL3[MAX_SEGMENT]
int la[MAX_SEGMENT][MAX_HIT_CHAM]
int charge() const
track electric charge
#define DEFINE_EDM_PLUGIN(factory, type, name)
float eycp[MAX_SEGMENT][MAX_HIT_CHAM]
float edxdzSl[MAX_SEGMENT]
float xc[MAX_SEGMENT][MAX_HIT_CHAM]
Detector det() const
get the detector field from this detid
AlignableNavigator * theAlignableDetAccessor
Constructor of the full muon geometry.
AlignmentParameterStore * theAlignmentParameterStore
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
float ex[MAX_SEGMENT][MAX_HIT_CHAM]
const align::Alignables & alignables(void) const
get all alignables
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
float xSlSL1[MAX_SEGMENT]
define event information passed to algorithms
void terminate(void)
Call at end of job.
float xSL3SL1[MAX_SEGMENT]
int nphihits[MAX_SEGMENT]