CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
MuonDTLocalMillepedeAlgorithm Class Reference

#include <MuonDTLocalMillepedeAlgorithm.h>

Inheritance diagram for MuonDTLocalMillepedeAlgorithm:
AlignmentAlgorithmBase

Classes

struct  Info1D
 

Public Member Functions

void initialize (const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignmentParameterStore *store)
 Call at beginning of job. More...
 
 MuonDTLocalMillepedeAlgorithm (const edm::ParameterSet &cfg)
 Constructor. More...
 
void run (const edm::EventSetup &setup, const EventInfo &eventInfo)
 Run the algorithm on trajectories and tracks. More...
 
void terminate (void)
 Call at end of job. More...
 
 ~MuonDTLocalMillepedeAlgorithm ()
 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::Run &, const edm::EventSetup &, bool changed)
 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 void initialize (const edm::EventSetup &setup, AlignableTracker *tracker, AlignableMuon *muon, AlignableExtras *extras, AlignmentParameterStore *store)=0
 Call at beginning of job (must be implemented in derived class) More...
 
virtual bool processesEvents ()
 Returns whether algorithm proccesses events in current configuration. More...
 
virtual bool setParametersForRunRange (const RunRange &rr)
 
virtual void startNewLoop ()
 
virtual bool storeAlignments ()
 Returns whether algorithm produced results to be stored. More...
 
virtual bool supportsCalibrations ()
 
virtual void terminate (const edm::EventSetup &iSetup)=0
 Call at end of each loop (must be implemented in derived class) More...
 
virtual ~AlignmentAlgorithmBase ()
 Destructor. More...
 

Private Member Functions

bool build4DSegments ()
 
void setBranchTrees ()
 

Private Attributes

float charge
 
edm::InputTag consTraj
 
float dxdzSl [5]
 
float dxdzSlSL1 [5]
 
float dxdzSlSL3 [5]
 
float dydzSl [5]
 
float edxdzSl [5]
 
float edxdzSlSL1 [5]
 
float edxdzSlSL3 [5]
 
float edydzSl [5]
 
float eta
 
float ex [5][14]
 
float excp [5][14]
 
float exdxdzSl [5]
 
float exdxdzSlSL1 [5]
 
float exdxdzSlSL3 [5]
 
float exSl [5]
 
float exSlSL1 [5]
 
float exSlSL3 [5]
 
float eycp [5][14]
 
float eydydzSl [5]
 
float eySl [5]
 
TFile * f
 
edm::Service< TFileServicefs
 
edm::InputTag globalTracks
 
int la [5][14]
 
float meandxdz [5][4][14]
 
float meandydz [5][4][14]
 
float meanx [5][4][14]
 
float meany [5][4][14]
 
Info1D myTrack1D
 
int nhits [5]
 
int nMtxSection
 
int nphihits [5]
 
float nPhihits
 
int nseg
 
int nthetahits [5]
 
float nThetahits
 
std::string ntuplePath
 
int numberOfRootFiles
 
float numberOfSigmasDXDZ
 
float numberOfSigmasDYDZ
 
float numberOfSigmasX
 
float numberOfSigmasY
 
float p
 
float phi
 
float pt
 
float ptMax
 
float ptMin
 
float sigmadxdz [5][4][14]
 
float sigmadydz [5][4][14]
 
float sigmax [5][4][14]
 
float sigmay [5][4][14]
 
int sl [5][14]
 
int sr [5]
 
int st [5]
 
TChain * tali
 
AlignableNavigatortheAlignableDetAccessor
 
align::Alignables theAlignables
 
AlignmentParameterStoretheAlignmentParameterStore
 
TTree * ttreeOutput
 
int wh [5]
 
int workingmode
 
float xc [5][14]
 
float xcp [5][14]
 
float xSl [5]
 
float xSL1SL3 [5]
 
float xSL3SL1 [5]
 
float xSlSL1 [5]
 
float xSlSL3 [5]
 
float yc [5][14]
 
float ycp [5][14]
 
float ySl [5]
 
float zc [5][14]
 

Additional Inherited Members

- Public Types inherited from AlignmentAlgorithmBase
typedef std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
 
typedef std::vector< ConstTrajTrackPairConstTrajTrackPairCollection
 
using RunNumber = align::RunNumber
 
using RunRange = align::RunRange
 

Detailed Description

Definition at line 30 of file MuonDTLocalMillepedeAlgorithm.h.

Constructor & Destructor Documentation

MuonDTLocalMillepedeAlgorithm::MuonDTLocalMillepedeAlgorithm ( const edm::ParameterSet cfg)

Constructor.

Definition at line 41 of file MuonDTLocalMillepedeAlgorithm.cc.

References f, edm::ParameterSet::getParameter(), nMtxSection, nPhihits, nThetahits, ntuplePath, numberOfRootFiles, numberOfSigmasDXDZ, numberOfSigmasDYDZ, numberOfSigmasX, numberOfSigmasY, ptMax, ptMin, setBranchTrees(), AlCaHLTBitMon_QueryRunRegistry::string, and workingmode.

41  :
43 {
44 
45  edm::LogInfo("Alignment") << "[MuonDTLocalMillepedeAlgorithm] constructed.";
46 
47  //Parse parameters. In the future this section should be completed with more options
48  ntuplePath = cfg.getParameter<std::string>( "ntuplePath" );
49  numberOfRootFiles = cfg.getParameter<int>( "numberOfRootFiles" );
50  ptMax = cfg.getParameter<double>( "ptMax" );
51  ptMin = cfg.getParameter<double>( "ptMin" );
52  numberOfSigmasX = cfg.getParameter<double>( "numberOfSigmasX" );
53  numberOfSigmasDXDZ = cfg.getParameter<double>( "numberOfSigmasDXDZ" );
54  numberOfSigmasY = cfg.getParameter<double>( "numberOfSigmasY" );
55  numberOfSigmasDYDZ = cfg.getParameter<double>( "numberOfSigmasDYDZ" );
56  nPhihits = cfg.getParameter<double>( "nPhihits" );
57  nThetahits = cfg.getParameter<double>( "nThetahits" );
58  workingmode = cfg.getParameter<int>( "workingMode" );
59  nMtxSection = cfg.getParameter<int>( "nMtxSection" );
60 
61 
62  //The algorithm has three working modes:
63  //0.- aligment information is extracted from the events and stored in root files
64  //1.- The SLtoSl algorithm
65  //2.- The local MuonMillepede algorithm
66  if(workingmode == 0) {
67  edm::LogInfo("Alignment") << "[MuonDTLocalMillepedeAlgorithm] Running on production mode.";
68  char nameOfFile[200];
69  snprintf(nameOfFile, sizeof(nameOfFile), "%s/MyNtupleResidual.root", ntuplePath.c_str());
70  f = new TFile(nameOfFile, "RECREATE");
71  f->cd();
73  } else if (workingmode == 1) {
74  edm::LogInfo("Alignment") << "[MuonDTLocalMillepedeAlgorithm] Running SLToSL algorithm.";
75  } else {
76  edm::LogInfo("Alignment") << "[MuonDTLocalMillepedeAlgorithm] Running Local Millepede algorithm.";
77  }
78 
79 }
T getParameter(std::string const &) const
AlignmentAlgorithmBase(const edm::ParameterSet &)
Constructor.
MuonDTLocalMillepedeAlgorithm::~MuonDTLocalMillepedeAlgorithm ( )
inline

Member Function Documentation

bool MuonDTLocalMillepedeAlgorithm::build4DSegments ( )
private

Definition at line 214 of file MuonDTLocalMillepedeAlgorithm.cc.

References counter, dxdzSl, dxdzSlSL1, dxdzSlSL3, dydzSl, edxdzSl, edxdzSlSL1, edxdzSlSL3, edydzSl, MuonDTLocalMillepedeAlgorithm::Info1D::erx, ex, excp, exdxdzSl, exdxdzSlSL1, exdxdzSlSL3, exSl, exSlSL1, exSlSL3, eycp, eydydzSl, eySl, gen::k, MuonDTLocalMillepedeAlgorithm::Info1D::la, la, MAX_HIT_CHAM, MAX_SEGMENT, myTrack1D, MuonDTLocalMillepedeAlgorithm::Info1D::nhits, nhits, nphihits, nPhihits, nseg, nthetahits, nThetahits, alignCSCRings::s, MuonDTLocalMillepedeAlgorithm::Info1D::sl, sl, MuonDTLocalMillepedeAlgorithm::Info1D::sr, sr, MuonDTLocalMillepedeAlgorithm::Info1D::st, st, MuonDTLocalMillepedeAlgorithm::Info1D::wh, wh, MuonDTLocalMillepedeAlgorithm::Info1D::xc, xc, xcp, xSl, xSL1SL3, xSL3SL1, xSlSL1, xSlSL3, MuonDTLocalMillepedeAlgorithm::Info1D::yc, yc, ycp, ySl, MuonDTLocalMillepedeAlgorithm::Info1D::zc, and zc.

Referenced by run(), and ~MuonDTLocalMillepedeAlgorithm().

214  {
215 
216  bool saveThis = false;
217 
218  //Set to 0
219  int id[20][5];
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;
224  }
225 
226 
227  int nChambers = 0;
228  for(int counter = 0; counter < myTrack1D.nhits; ++counter) {
229  bool isNew = true;
230  for(int counterCham = 0; counterCham < nChambers; counterCham++) {
231  if(myTrack1D.wh[counter] == id[counterCham][0] &&
232  myTrack1D.st[counter] == id[counterCham][1] &&
233  myTrack1D.sr[counter] == id[counterCham][2]) {
234  if(myTrack1D.sl[counter] == 2) {
235  id[counterCham][4]++;
236  } else {
237  id[counterCham][3]++;
238  }
239  for (int ila = 1; ila<=4; ila++)
240  if (myTrack1D.la[counter]==ila) {
241  int jla = (myTrack1D.sl[counter]-1)*4 + ila -1;
242  numlayer[counterCham][jla]++;
243  }
244  isNew = false;
245  }
246  }
247  if(isNew) {
248  id[nChambers][0] = myTrack1D.wh[counter];
249  id[nChambers][1] = myTrack1D.st[counter];
250  id[nChambers][2] = myTrack1D.sr[counter];
251  if(myTrack1D.sl[counter] == 2) {
252  id[nChambers][4]++;
253  } else {
254  id[nChambers][3]++;
255  }
256  for (int ila = 1; ila<=4; ila++)
257  if (myTrack1D.la[counter]==ila) {
258  int jla = (myTrack1D.sl[counter]-1)*4 + ila -1;
259  numlayer[nChambers][jla]++;
260  }
261  nChambers++;
262  }
263  }
264 
265  for (int iseg = 0; iseg<MAX_SEGMENT; iseg++)
266  for (int ihit = 0; ihit<MAX_HIT_CHAM; ihit++) {
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.;
275  sl[iseg][ihit] = 0;
276  la[iseg][ihit] = 0;
277  }
278 
279  nseg = 0;
280  for(int counter = 0; counter < nChambers; ++counter) {
281 
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;
286  }
287 
288  if(id[counter][3] >= nPhihits && (id[counter][4] >= nThetahits || id[counter][1] == 4) &&
289  GoodPhiChamber && GoodThetaChamber) {
290 
291  TMatrixD phiProjection(2,2);
292  TMatrixD thetaProjection(2,2);
293  TMatrixD bphiProjection(2,1);
294  TMatrixD bthetaProjection(2,1);
295 
296  TMatrixD phiProjectionSL1(2,2);
297  TMatrixD bphiProjectionSL1(2,1);
298  TMatrixD phiProjectionSL3(2,2);
299  TMatrixD bphiProjectionSL3(2,1);
300 
301  float SL1_z_ave = 0;
302  float SL3_z_ave = 0;
303 
304  int numh1 = 0, numh2 = 0, numh3 = 0;
305  for(int counterH = 0; counterH < myTrack1D.nhits; ++counterH) {
306  if(myTrack1D.wh[counterH] == id[counter][0] && myTrack1D.st[counterH] == id[counter][1] &&
307  myTrack1D.sr[counterH] == id[counter][2]) {
308  if(myTrack1D.sl[counterH] == 2) {
309  numh2++;
310  thetaProjection(0,0) += 1.0/myTrack1D.erx[counterH];
311  thetaProjection(0,1) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
312  thetaProjection(1,0) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
313  thetaProjection(1,1) += myTrack1D.zc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
314  bthetaProjection(0,0) += myTrack1D.yc[counterH]/myTrack1D.erx[counterH];
315  bthetaProjection(1,0) += myTrack1D.yc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
316  } else {
317  phiProjection(0,0) += 1.0/myTrack1D.erx[counterH];
318  phiProjection(0,1) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
319  phiProjection(1,0) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
320  phiProjection(1,1) += myTrack1D.zc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
321  bphiProjection(0,0) += myTrack1D.xc[counterH]/myTrack1D.erx[counterH];
322  bphiProjection(1,0) += myTrack1D.xc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
323  if(myTrack1D.sl[counterH] == 1) {
324  numh1++;
325  phiProjectionSL1(0,0) += 1.0/myTrack1D.erx[counterH];
326  phiProjectionSL1(0,1) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
327  phiProjectionSL1(1,0) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
328  phiProjectionSL1(1,1) += myTrack1D.zc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
329  bphiProjectionSL1(0,0) += myTrack1D.xc[counterH]/myTrack1D.erx[counterH];
330  bphiProjectionSL1(1,0) += myTrack1D.xc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
331  SL1_z_ave += myTrack1D.zc[counterH];
332  } else {
333  numh3++;
334  phiProjectionSL3(0,0) += 1.0/myTrack1D.erx[counterH];
335  phiProjectionSL3(0,1) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
336  phiProjectionSL3(1,0) += myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
337  phiProjectionSL3(1,1) += myTrack1D.zc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
338  bphiProjectionSL3(0,0) += myTrack1D.xc[counterH]/myTrack1D.erx[counterH];
339  bphiProjectionSL3(1,0) += myTrack1D.xc[counterH]*myTrack1D.zc[counterH]/myTrack1D.erx[counterH];
340  SL3_z_ave += myTrack1D.zc[counterH];
341  }
342  }
343  }
344  }
345 
346  SL1_z_ave /= 4.0;
347  SL3_z_ave /= 4.0;
348 
349  if (phiProjection(0,0) != 0 && phiProjectionSL1(0,0) != 0 && phiProjectionSL3(0,0) != 0 &&
350  (thetaProjection(0,0) != 0 || id[counter][1] == 4)) {
351 
352  wh[nseg] = id[counter][0];
353  st[nseg] = id[counter][1];
354  sr[nseg] = id[counter][2];
355 
356  if(thetaProjection(0,0) != 0 && id[counter][1] != 4) { // Already asked (almost)
357  thetaProjection.Invert();
358  TMatrixD solution = thetaProjection*bthetaProjection;
359  ySl[nseg] = solution(0,0);
360  dydzSl[nseg] = solution(1,0);
361  eySl[nseg] = thetaProjection(0,0);
362  edydzSl[nseg] = thetaProjection(1,1);
363  eydydzSl[nseg] = thetaProjection(0,1);
364  }
365  phiProjection.Invert();
366  phiProjectionSL1.Invert();
367  phiProjectionSL3.Invert();
368  TMatrixD solution = phiProjection*bphiProjection;
369  TMatrixD solutionSL1 = phiProjectionSL1*bphiProjectionSL1;
370  TMatrixD solutionSL3 = phiProjectionSL3*bphiProjectionSL3;
371  xSl[nseg] = solution(0,0);
372  dxdzSl[nseg] = solution(1,0);
373  exSl[nseg] = phiProjection(0,0);
374  edxdzSl[nseg] = phiProjection(1,1);
375  exdxdzSl[nseg] = phiProjection(0,0);
376  xSlSL1[nseg] = solutionSL1(0,0);
377  dxdzSlSL1[nseg] = solutionSL1(1,0);
378  exSlSL1[nseg] = phiProjectionSL1(0,0);
379  edxdzSlSL1[nseg] = phiProjectionSL1(1,1);
380  exdxdzSlSL1[nseg] = phiProjectionSL1(0,0);
381  xSL1SL3[nseg] = solutionSL1(0,0) + SL3_z_ave * solutionSL1(1,0);
382  xSlSL3[nseg] = solutionSL3(0,0);
383  dxdzSlSL3[nseg] = solutionSL3(1,0);
384  exSlSL3[nseg] = phiProjectionSL3(0,0);
385  edxdzSlSL3[nseg] = phiProjectionSL3(1,1);
386  exdxdzSlSL3[nseg] = phiProjectionSL3(0,0);
387  xSL3SL1[nseg] = solutionSL3(0,0) + SL1_z_ave * solutionSL3(1,0);
388  int hitcounter = 0;
389  for(int counterH = 0; counterH < myTrack1D.nhits; ++counterH) {
390  if(myTrack1D.wh[counterH] == wh[nseg] && myTrack1D.st[counterH] == st[nseg] &&
391  myTrack1D.sr[counterH] == sr[nseg]) {
392  xc[nseg][hitcounter] = myTrack1D.xc[counterH];
393  yc[nseg][hitcounter] = myTrack1D.yc[counterH];
394  zc[nseg][hitcounter] = myTrack1D.zc[counterH];
395  ex[nseg][hitcounter] = myTrack1D.erx[counterH];
396  xcp[nseg][hitcounter] = xSl[nseg]+dxdzSl[nseg]*myTrack1D.zc[counterH];
397  ycp[nseg][hitcounter] = ySl[nseg]+dydzSl[nseg]*myTrack1D.zc[counterH];
398  excp[nseg][hitcounter] = exSl[nseg]*exSl[nseg]+ (edxdzSl[nseg]*edxdzSl[nseg])*myTrack1D.zc[counterH];
399  eycp[nseg][hitcounter] = eySl[nseg]*eySl[nseg]+ (edydzSl[nseg]*edydzSl[nseg])*myTrack1D.zc[counterH];
400  sl[nseg][hitcounter] = myTrack1D.sl[counterH];
401  la[nseg][hitcounter] = myTrack1D.la[counterH];
402  saveThis = true;
403  hitcounter++;
404  }
405  }
406  nphihits[nseg] = id[counter][3];
407  nthetahits[nseg] = id[counter][4];
408  nhits[nseg] = hitcounter;
409  nseg++;
410  }
411  }
412  }
413  return saveThis;
414 }
#define MAX_SEGMENT
int k[5][pyjets_maxn]
static std::atomic< unsigned int > counter
#define MAX_HIT_CHAM
void MuonDTLocalMillepedeAlgorithm::initialize ( const edm::EventSetup setup,
AlignableTracker tracker,
AlignableMuon muon,
AlignmentParameterStore store 
)

Call at beginning of job.

Definition at line 86 of file MuonDTLocalMillepedeAlgorithm.cc.

References AlignmentParameterStore::alignables(), theAlignableDetAccessor, theAlignables, and theAlignmentParameterStore.

Referenced by ~MuonDTLocalMillepedeAlgorithm().

89 {
90 
91  // accessor Det->AlignableDet
92  if ( !muon )
94  else if ( !tracker )
96  else
97  theAlignableDetAccessor = new AlignableNavigator(tracker,muon);
98 
99  // set alignmentParameterStore
101 
102  // get alignables
104 
105 }
AlignmentParameterStore * theAlignmentParameterStore
const align::Alignables & alignables(void) const
get all alignables
void MuonDTLocalMillepedeAlgorithm::run ( const edm::EventSetup setup,
const EventInfo eventInfo 
)
virtual

Run the algorithm on trajectories and tracks.

Implements AlignmentAlgorithmBase.

Definition at line 132 of file MuonDTLocalMillepedeAlgorithm.cc.

References build4DSegments(), charge, reco::TrackBase::charge(), DetId::det(), TrackingRecHit::det(), MuonDTLocalMillepedeAlgorithm::Info1D::erx, eta, reco::TrackBase::eta(), GeomDet::geographicalId(), TrackingRecHit::isValid(), MuonDTLocalMillepedeAlgorithm::Info1D::la, Trajectory::measurements(), myTrack1D, MuonDTLocalMillepedeAlgorithm::Info1D::nhits, p, reco::TrackBase::p(), phi, reco::TrackBase::phi(), pt, reco::TrackBase::pt(), ptMax, DetId::rawId(), TrajectoryMeasurement::recHit(), MuonDTLocalMillepedeAlgorithm::Info1D::sl, MuonDTLocalMillepedeAlgorithm::Info1D::sr, MuonDTLocalMillepedeAlgorithm::Info1D::st, DetId::subdetId(), theAlignableDetAccessor, GeomDet::toGlobal(), HiIsolationCommonParameters_cff::track, l1t::tracks, AlignmentAlgorithmBase::EventInfo::trajTrackPairs(), ttreeOutput, MuonDTLocalMillepedeAlgorithm::Info1D::wh, workingmode, PV3DBase< T, PVType, FrameType >::x(), MuonDTLocalMillepedeAlgorithm::Info1D::xc, PV3DBase< T, PVType, FrameType >::y(), MuonDTLocalMillepedeAlgorithm::Info1D::yc, PV3DBase< T, PVType, FrameType >::z(), and MuonDTLocalMillepedeAlgorithm::Info1D::zc.

Referenced by DTWorkflow.DTWorkflow::all(), Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), o2olib.O2OTool::execute(), and ~MuonDTLocalMillepedeAlgorithm().

134 {
135 
136  //Only important in the production mode
137  if(workingmode != 0) return;
138 
140  for( ConstTrajTrackPairCollection::const_iterator it=tracks.begin();
141  it!=tracks.end();it++) {
142 
143  const Trajectory *traj = (*it).first;
144  const reco::Track *track = (*it).second;
145 
146  p = track->p();
147  pt = track->pt();
148  eta = track->eta();
149  phi = track->phi();
150  charge = track->charge();
151 
152 
153  if(pt < ptMin || pt > ptMax) continue;
154 
155  vector<const TransientTrackingRecHit*> hitvec;
156  vector<TrajectoryMeasurement> measurements = traj->measurements();
157 
158  //In this loop the measurements and hits are extracted and put into two vectors
159  int ch_muons = 0;
160  for (vector<TrajectoryMeasurement>::iterator im=measurements.begin();
161  im!=measurements.end(); im++) {
162  TrajectoryMeasurement meas = *im;
163  const TransientTrackingRecHit* hit = &(*meas.recHit());
164  //We are not very strict at this point
165  if (hit->isValid()) {
166  if(hit->det()->geographicalId().det() == 2 && hit->det()->geographicalId().subdetId() == 1) {
167  hitvec.push_back(hit);
168  ch_muons++;
169  }
170  }
171  }
172 
173 
174  vector<const TransientTrackingRecHit*>::const_iterator ihit=hitvec.begin();
175  //Information is stored temporally in the myTrack1D object, which is analyzed
176  //in the build4DSegments method in order to associate hits to segments.
177  int ch_counter = 0;
178  while (ihit != hitvec.end())
179  {
180  const GeomDet* det=(*ihit)->det();
181  if(det->geographicalId().det() == 2) {
182  if(det->geographicalId().subdetId() == 1) {
183  DTLayerId mLayer(det->geographicalId().rawId());
184  DTChamberId mChamber(mLayer.wheel(), mLayer.station(), mLayer.sector());
185  AlignableDet *aliDet = theAlignableDetAccessor->alignableDetFromDetId(mChamber);
186  myTrack1D.wh[ch_counter] = mLayer.wheel();
187  myTrack1D.st[ch_counter] = mLayer.station();
188  myTrack1D.sr[ch_counter] = mLayer.sector();
189  myTrack1D.sl[ch_counter] = mLayer.superlayer();
190  myTrack1D.la[ch_counter] = mLayer.layer();
191  myTrack1D.erx[ch_counter] = (*ihit)->localPositionError().xx();
192  align::GlobalPoint globhit = det->toGlobal((*ihit)->localPosition());
193  align::LocalPoint seghit = aliDet->surface().toLocal(globhit);
194  myTrack1D.xc[ch_counter] = seghit.x();
195  myTrack1D.yc[ch_counter] = seghit.y();
196  myTrack1D.zc[ch_counter] = seghit.z();
197  ch_counter++;
198  }
199  }
200  ihit++;
201  }
202  myTrack1D.nhits = ch_counter;
203  if(build4DSegments()) ttreeOutput->Fill();
204  }
205 
206 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:615
ConstRecHitPointer const & recHit() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
T y() const
Definition: PV3DBase.h:63
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:645
const ConstTrajTrackPairCollection & trajTrackPairs() const
DataContainer const & measurements() const
Definition: Trajectory.h:196
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
const GeomDet * det() const
double pt() const
track transverse momentum
Definition: TrackBase.h:621
T z() const
Definition: PV3DBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:79
bool isValid() const
int charge() const
track electric charge
Definition: TrackBase.h:567
T x() const
Definition: PV3DBase.h:62
std::vector< ConstTrajTrackPair > ConstTrajTrackPairCollection
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
void MuonDTLocalMillepedeAlgorithm::setBranchTrees ( )
private

Definition at line 419 of file MuonDTLocalMillepedeAlgorithm.cc.

References charge, DEFINE_EDM_PLUGIN, dxdzSl, dxdzSlSL1, dxdzSlSL3, dydzSl, edxdzSl, edxdzSlSL1, edxdzSlSL3, edydzSl, eta, ex, excp, exSl, exSlSL1, exSlSL3, eycp, eydydzSl, eySl, la, nhits, nphihits, nseg, nthetahits, p, phi, pt, sl, sr, st, ttreeOutput, wh, xc, xcp, xSl, xSL1SL3, xSL3SL1, xSlSL1, xSlSL3, yc, ycp, ySl, and zc.

Referenced by MuonDTLocalMillepedeAlgorithm(), and ~MuonDTLocalMillepedeAlgorithm().

419  {
420 
421  ttreeOutput = new TTree("InfoTuple", "InfoTuple");
422 
423  ttreeOutput->Branch("p", &p, "p/F");
424  ttreeOutput->Branch("pt", &pt, "pt/F");
425  ttreeOutput->Branch("eta", &eta, "eta/F");
426  ttreeOutput->Branch("phi", &phi, "phi/F");
427  ttreeOutput->Branch("charge", &charge, "charge/F");
428  ttreeOutput->Branch("nseg", &nseg, "nseg/I");
429  ttreeOutput->Branch("nphihits", nphihits, "nphihits[nseg]/I");
430  ttreeOutput->Branch("nthetahits", nthetahits, "nthetahits[nseg]/I");
431  ttreeOutput->Branch("nhits", nhits, "nhits[nseg]/I");
432  ttreeOutput->Branch("xSl", xSl, "xSl[nseg]/F");
433  ttreeOutput->Branch("dxdzSl", dxdzSl, "dxdzSl[nseg]/F");
434  ttreeOutput->Branch("exSl", exSl, "exSl[nseg]/F");
435  ttreeOutput->Branch("edxdzSl", edxdzSl, "edxdzSl[nseg]/F");
436  ttreeOutput->Branch("exdxdzSl", edxdzSl, "exdxdzSl[nseg]/F");
437  ttreeOutput->Branch("ySl", ySl, "ySl[nseg]/F");
438  ttreeOutput->Branch("dydzSl", dydzSl, "dydzSl[nseg]/F");
439  ttreeOutput->Branch("eySl", eySl, "eySl[nseg]/F");
440  ttreeOutput->Branch("edydzSl", edydzSl, "edydzSl[nseg]/F");
441  ttreeOutput->Branch("eydydzSl", eydydzSl, "eydydzSl[nseg]/F");
442  ttreeOutput->Branch("xSlSL1", xSlSL1, "xSlSL1[nseg]/F");
443  ttreeOutput->Branch("dxdzSlSL1", dxdzSlSL1, "dxdzSlSL1[nseg]/F");
444  ttreeOutput->Branch("exSlSL1", exSlSL1, "exSlSL1[nseg]/F");
445  ttreeOutput->Branch("edxdzSlSL1", edxdzSlSL1, "edxdzSlSL1[nseg]/F");
446  ttreeOutput->Branch("xSL1SL3", xSL1SL3, "xSL1SL3[nseg]/F");
447  ttreeOutput->Branch("xSlSL3", xSlSL3, "xSlSL3[nseg]/F");
448  ttreeOutput->Branch("dxdzSlSL3", dxdzSlSL3, "dxdzSlSL3[nseg]/F");
449  ttreeOutput->Branch("exSlSL3", exSlSL3, "exSlSL3[nseg]/F");
450  ttreeOutput->Branch("edxdzSlSL3", edxdzSlSL3, "edxdzSlSL3[nseg]/F");
451  ttreeOutput->Branch("xSL3SL1", xSL3SL1, "xSL3SL1[nseg]/F");
452  ttreeOutput->Branch("xc", xc, "xc[nseg][14]/F");
453  ttreeOutput->Branch("yc", yc, "yc[nseg][14]/F");
454  ttreeOutput->Branch("zc", zc, "zc[nseg][14]/F");
455  ttreeOutput->Branch("ex", ex, "ex[nseg][14]/F");
456  ttreeOutput->Branch("xcp", xcp, "xcp[nseg][14]/F");
457  ttreeOutput->Branch("ycp", ycp, "ycp[nseg][14]/F");
458  ttreeOutput->Branch("excp", excp, "excp[nseg][14]/F");
459  ttreeOutput->Branch("eycp", eycp, "eycp[nseg][14]/F");
460  ttreeOutput->Branch("wh", wh, "wh[nseg]/I");
461  ttreeOutput->Branch("st", st, "st[nseg]/I");
462  ttreeOutput->Branch("sr", sr, "sr[nseg]/I");
463  ttreeOutput->Branch("sl", sl, "sl[nseg][14]/I");
464  ttreeOutput->Branch("la", la, "la[nseg][14]/I");
465 
466 }
void MuonDTLocalMillepedeAlgorithm::terminate ( void  )
virtual

Call at end of job.

Reimplemented from AlignmentAlgorithmBase.

Definition at line 110 of file MuonDTLocalMillepedeAlgorithm.cc.

References f, nMtxSection, nPhihits, nThetahits, ntuplePath, numberOfRootFiles, ptMax, ptMin, and workingmode.

Referenced by ~MuonDTLocalMillepedeAlgorithm().

111 {
112 
113  //If workingmode equals 1 or 2, the algorithms are run before saving.
114  if(workingmode == 1) {
115  edm::LogInfo("Alignment") << "[MuonDTLocalMillepedeAlgorithm] Starting SLToSL algorithm";
117  } else if(workingmode >= 2) {
118  edm::LogInfo("Alignment") << "[MuonDTLocalMillepedeAlgorithm] Starting local MuonMillepede algorithm";
120  }
121 
122  if (workingmode==0) {
123  f->Write();
124  f->Close();
125  }
126 
127 }

Member Data Documentation

float MuonDTLocalMillepedeAlgorithm::charge
private
edm::InputTag MuonDTLocalMillepedeAlgorithm::consTraj
private

Definition at line 135 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::dxdzSl[5]
private

Definition at line 84 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::dxdzSlSL1[5]
private

Definition at line 94 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::dxdzSlSL3[5]
private

Definition at line 100 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::dydzSl[5]
private

Definition at line 89 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::edxdzSl[5]
private

Definition at line 86 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::edxdzSlSL1[5]
private

Definition at line 96 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::edxdzSlSL3[5]
private

Definition at line 102 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::edydzSl[5]
private

Definition at line 91 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::eta
private
float MuonDTLocalMillepedeAlgorithm::ex[5][14]
private

Definition at line 108 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::excp[5][14]
private

Definition at line 111 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::exdxdzSl[5]
private

Definition at line 87 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments().

float MuonDTLocalMillepedeAlgorithm::exdxdzSlSL1[5]
private

Definition at line 97 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments().

float MuonDTLocalMillepedeAlgorithm::exdxdzSlSL3[5]
private

Definition at line 103 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments().

float MuonDTLocalMillepedeAlgorithm::exSl[5]
private

Definition at line 85 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::exSlSL1[5]
private

Definition at line 95 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::exSlSL3[5]
private

Definition at line 101 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::eycp[5][14]
private

Definition at line 112 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::eydydzSl[5]
private

Definition at line 92 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::eySl[5]
private

Definition at line 90 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

TFile* MuonDTLocalMillepedeAlgorithm::f
private
edm::Service<TFileService> MuonDTLocalMillepedeAlgorithm::fs
private

Definition at line 132 of file MuonDTLocalMillepedeAlgorithm.h.

edm::InputTag MuonDTLocalMillepedeAlgorithm::globalTracks
private

Definition at line 134 of file MuonDTLocalMillepedeAlgorithm.h.

int MuonDTLocalMillepedeAlgorithm::la[5][14]
private

Definition at line 115 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::meandxdz[5][4][14]
private

Definition at line 154 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::meandydz[5][4][14]
private

Definition at line 158 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::meanx[5][4][14]
private

Definition at line 152 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::meany[5][4][14]
private

Definition at line 156 of file MuonDTLocalMillepedeAlgorithm.h.

Info1D MuonDTLocalMillepedeAlgorithm::myTrack1D
private

Definition at line 73 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and run().

int MuonDTLocalMillepedeAlgorithm::nhits[5]
private

Definition at line 82 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

int MuonDTLocalMillepedeAlgorithm::nMtxSection
private

Definition at line 143 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm(), and terminate().

int MuonDTLocalMillepedeAlgorithm::nphihits[5]
private

Definition at line 80 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::nPhihits
private
int MuonDTLocalMillepedeAlgorithm::nseg
private

Definition at line 79 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

int MuonDTLocalMillepedeAlgorithm::nthetahits[5]
private

Definition at line 81 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::nThetahits
private
std::string MuonDTLocalMillepedeAlgorithm::ntuplePath
private

Definition at line 136 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm(), and terminate().

int MuonDTLocalMillepedeAlgorithm::numberOfRootFiles
private

Definition at line 142 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm(), and terminate().

float MuonDTLocalMillepedeAlgorithm::numberOfSigmasDXDZ
private

Definition at line 148 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm().

float MuonDTLocalMillepedeAlgorithm::numberOfSigmasDYDZ
private

Definition at line 150 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm().

float MuonDTLocalMillepedeAlgorithm::numberOfSigmasX
private

Definition at line 147 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm().

float MuonDTLocalMillepedeAlgorithm::numberOfSigmasY
private

Definition at line 149 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm().

float MuonDTLocalMillepedeAlgorithm::p
private
float MuonDTLocalMillepedeAlgorithm::phi
private
float MuonDTLocalMillepedeAlgorithm::pt
private
float MuonDTLocalMillepedeAlgorithm::ptMax
private

Definition at line 137 of file MuonDTLocalMillepedeAlgorithm.h.

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

float MuonDTLocalMillepedeAlgorithm::ptMin
private

Definition at line 138 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by MuonDTLocalMillepedeAlgorithm(), and terminate().

float MuonDTLocalMillepedeAlgorithm::sigmadxdz[5][4][14]
private

Definition at line 155 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::sigmadydz[5][4][14]
private

Definition at line 159 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::sigmax[5][4][14]
private

Definition at line 153 of file MuonDTLocalMillepedeAlgorithm.h.

float MuonDTLocalMillepedeAlgorithm::sigmay[5][4][14]
private

Definition at line 157 of file MuonDTLocalMillepedeAlgorithm.h.

int MuonDTLocalMillepedeAlgorithm::sl[5][14]
private

Definition at line 114 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

int MuonDTLocalMillepedeAlgorithm::sr[5]
private

Definition at line 113 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

int MuonDTLocalMillepedeAlgorithm::st[5]
private

Definition at line 113 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

TChain* MuonDTLocalMillepedeAlgorithm::tali
private

Definition at line 124 of file MuonDTLocalMillepedeAlgorithm.h.

AlignableNavigator* MuonDTLocalMillepedeAlgorithm::theAlignableDetAccessor
private

Definition at line 129 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by initialize(), and run().

align::Alignables MuonDTLocalMillepedeAlgorithm::theAlignables
private

Definition at line 128 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by initialize().

AlignmentParameterStore* MuonDTLocalMillepedeAlgorithm::theAlignmentParameterStore
private

Definition at line 127 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by initialize().

TTree* MuonDTLocalMillepedeAlgorithm::ttreeOutput
private

Definition at line 123 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by run(), and setBranchTrees().

int MuonDTLocalMillepedeAlgorithm::wh[5]
private

Definition at line 113 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

int MuonDTLocalMillepedeAlgorithm::workingmode
private

Definition at line 141 of file MuonDTLocalMillepedeAlgorithm.h.

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

float MuonDTLocalMillepedeAlgorithm::xc[5][14]
private
float MuonDTLocalMillepedeAlgorithm::xcp[5][14]
private

Definition at line 109 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::xSl[5]
private

Definition at line 83 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::xSL1SL3[5]
private

Definition at line 98 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::xSL3SL1[5]
private

Definition at line 104 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::xSlSL1[5]
private

Definition at line 93 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::xSlSL3[5]
private

Definition at line 99 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::yc[5][14]
private
float MuonDTLocalMillepedeAlgorithm::ycp[5][14]
private

Definition at line 110 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::ySl[5]
private

Definition at line 88 of file MuonDTLocalMillepedeAlgorithm.h.

Referenced by build4DSegments(), and setBranchTrees().

float MuonDTLocalMillepedeAlgorithm::zc[5][14]
private