CMS 3D CMS Logo

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

#include <ReadPGInfo.h>

Public Member Functions

char * getId (int, int, int)
 
TMatrixD giveQC (int, int, int)
 
TMatrixD giveQCCal (int, int, int)
 
TMatrixD giveR (int, int, int)
 
TMatrixD giveSurvey (int, int, int)
 
 ReadPGInfo (const char *name)
 
 ~ReadPGInfo ()
 

Private Attributes

TFile * rootFile
 

Detailed Description

Date
2010/02/25 11:33:32
Revision
1.3
Author
Luca Scodellaro Luca..nosp@m.Scod.nosp@m.ellar.nosp@m.o@ce.nosp@m.rn.ch

Definition at line 16 of file ReadPGInfo.h.

Constructor & Destructor Documentation

◆ ReadPGInfo()

ReadPGInfo::ReadPGInfo ( const char *  name)

Definition at line 321 of file ReadPGInfo.cc.

References Skims_PA_cff::name, and rootFile.

321  {
322  TDirectory *dirSave = gDirectory;
323  rootFile = new TFile(name);
324  dirSave->cd();
325 }
TFile * rootFile
Definition: ReadPGInfo.h:27

◆ ~ReadPGInfo()

ReadPGInfo::~ReadPGInfo ( )

Definition at line 327 of file ReadPGInfo.cc.

References rootFile.

327 { delete rootFile; }
TFile * rootFile
Definition: ReadPGInfo.h:27

Member Function Documentation

◆ getId()

char * ReadPGInfo::getId ( int  wheel,
int  station,
int  sector 
)

Definition at line 329 of file ReadPGInfo.cc.

References chambers, counter, position, relativeConstraints::station, TOTALCHAMBERS, and makeMuonMisalignmentScenario::wheel.

Referenced by giveQC(), giveR(), and giveSurvey().

329  {
330  for (int counter = 0; counter < TOTALCHAMBERS; ++counter) {
331  if (wheel == position[counter][0] && sector == position[counter][1] && station == position[counter][2])
332  return chambers[counter];
333  }
334  return nullptr;
335 }
#define TOTALCHAMBERS
Definition: ReadPGInfo.h:14
static std::atomic< unsigned int > counter
static int position[264][3]
Definition: ReadPGInfo.cc:289
static char chambers[264][20]
Definition: ReadPGInfo.cc:243

◆ giveQC()

TMatrixD ReadPGInfo::giveQC ( int  wheel,
int  station,
int  sector 
)

Definition at line 371 of file ReadPGInfo.cc.

References relativeConstraints::empty, getId(), rootFile, relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

Referenced by giveQCCal().

371  {
372  TMatrixD *empty = new TMatrixD(0, 0);
373  char *id = getId(wheel, station, sector);
374  if (id == nullptr)
375  return *empty;
376  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
377  TDirectoryFile *myQC = (TDirectoryFile *)myDir->Get("QCW");
378  TMatrixD *QC;
379  if (myQC == nullptr) {
380  QC = new TMatrixD(0, 0);
381  } else {
382  QC = (TMatrixD *)myQC->Get("matrix");
383  }
384  return *QC;
385 }
TFile * rootFile
Definition: ReadPGInfo.h:27
char * getId(int, int, int)
Definition: ReadPGInfo.cc:329

◆ giveQCCal()

TMatrixD ReadPGInfo::giveQCCal ( int  wheel,
int  station,
int  sector 
)

Definition at line 348 of file ReadPGInfo.cc.

References c, relativeConstraints::error, giveQC(), edmScanValgrind::maxCount, relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

Referenced by DTMuonMillepede::getbcsMatrix(), DTMuonMillepede::getbqcMatrix(), DTMuonMillepede::getCcsMatrix(), and DTMuonMillepede::getCqcMatrix().

348  {
349  TMatrixD *mat = new TMatrixD(0, 0);
350  TMatrixD qc = giveQC(wheel, station, sector);
351  if (qc.GetNrows() == 0)
352  return *mat;
353  mat->ResizeTo(12, 2);
354  int maxCount = 12;
355  if (station == 4)
356  maxCount = 8;
357  for (int c = 0; c < maxCount; ++c) {
358  float error;
359  if (qc(c, 1) == 0 || qc(c, 3) == 0) {
360  (*mat)(c, 0) = (qc(c, 0) + qc(c, 2)) / 2.0;
361  (*mat)(c, 1) = 500;
362  } else {
363  error = 1.0 / (1.0 / (qc(c, 1) * qc(c, 1)) + 1.0 / (qc(c, 3) * qc(c, 3)));
364  (*mat)(c, 0) = (qc(c, 0) / (qc(c, 1) * qc(c, 1)) + qc(c, 2) / (qc(c, 3) * qc(c, 3))) * error;
365  (*mat)(c, 1) = TMath::Sqrt(error);
366  }
367  }
368  return *mat;
369 }
TMatrixD giveQC(int, int, int)
Definition: ReadPGInfo.cc:371

◆ giveR()

TMatrixD ReadPGInfo::giveR ( int  wheel,
int  station,
int  sector 
)

Definition at line 337 of file ReadPGInfo.cc.

References relativeConstraints::empty, getId(), dttmaxenums::R, rootFile, relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

337  {
338  TMatrixD *empty = new TMatrixD(0, 0);
339  char *id = getId(wheel, station, sector);
340  if (id == nullptr)
341  return *empty;
342  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
343  TDirectoryFile *myR = (TDirectoryFile *)myDir->Get("R");
344  TMatrixD *R = (TMatrixD *)myR->Get("matrix");
345  return *R;
346 }
TFile * rootFile
Definition: ReadPGInfo.h:27
char * getId(int, int, int)
Definition: ReadPGInfo.cc:329

◆ giveSurvey()

TMatrixD ReadPGInfo::giveSurvey ( int  wheel,
int  station,
int  sector 
)

Definition at line 387 of file ReadPGInfo.cc.

References relativeConstraints::empty, getId(), rootFile, relativeConstraints::station, and makeMuonMisalignmentScenario::wheel.

Referenced by DTMuonMillepede::getbcsMatrix(), and DTMuonMillepede::getbsurveyMatrix().

387  {
388  TMatrixD *empty = new TMatrixD(0, 0);
389  char *id = getId(wheel, station, sector);
390  if (id == nullptr)
391  return *empty;
392  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
393  TDirectoryFile *mySur = (TDirectoryFile *)myDir->Get("Survey");
394  TMatrixD *Survey = (TMatrixD *)mySur->Get("matrix_layer");
395  return *Survey;
396 }
TFile * rootFile
Definition: ReadPGInfo.h:27
char * getId(int, int, int)
Definition: ReadPGInfo.cc:329

Member Data Documentation

◆ rootFile

TFile* ReadPGInfo::rootFile
private

Definition at line 27 of file ReadPGInfo.h.

Referenced by giveQC(), giveR(), giveSurvey(), ReadPGInfo(), and ~ReadPGInfo().