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 ( const char *  name)

Definition at line 775 of file ReadPGInfo.cc.

References rootFile.

775  {
776  TDirectory * dirSave = gDirectory;
777  rootFile = new TFile(name);
778  dirSave->cd();
779 }
TFile * rootFile
Definition: ReadPGInfo.h:29
ReadPGInfo::~ReadPGInfo ( )

Definition at line 781 of file ReadPGInfo.cc.

References rootFile.

781 {delete rootFile;}
TFile * rootFile
Definition: ReadPGInfo.h:29

Member Function Documentation

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

Definition at line 783 of file ReadPGInfo.cc.

References chambers, counter, position, and TOTALCHAMBERS.

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

783  {
784  for(int counter = 0; counter < TOTALCHAMBERS; ++counter) {
785  if(wheel == position[counter][0] && sector == position[counter][1] && station == position[counter][2])
786  return chambers[counter];
787  }
788  return nullptr;
789 }
#define TOTALCHAMBERS
Definition: ReadPGInfo.h:14
static std::atomic< unsigned int > counter
static int position[264][3]
Definition: ReadPGInfo.cc:509
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
TMatrixD ReadPGInfo::giveQC ( int  wheel,
int  station,
int  sector 
)

Definition at line 824 of file ReadPGInfo.cc.

References relativeConstraints::empty, getId(), and rootFile.

Referenced by giveQCCal().

824  {
825  TMatrixD *empty = new TMatrixD(0,0);
826  char *id = getId(wheel, station, sector);
827  if(id == nullptr) return *empty;
828  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
829  TDirectoryFile *myQC = (TDirectoryFile *)myDir->Get("QCW");
830  TMatrixD *QC;
831  if(myQC == nullptr) {
832  QC = new TMatrixD(0,0);
833  } else {
834  QC = (TMatrixD *)myQC->Get("matrix");
835  }
836  return *QC;
837 }
TFile * rootFile
Definition: ReadPGInfo.h:29
char * getId(int, int, int)
Definition: ReadPGInfo.cc:783
TMatrixD ReadPGInfo::giveQCCal ( int  wheel,
int  station,
int  sector 
)

Definition at line 803 of file ReadPGInfo.cc.

References EnergyCorrector::c, relativeConstraints::error, giveQC(), and edmScanValgrind::maxCount.

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

803  {
804  TMatrixD *mat = new TMatrixD(0,0);
805  TMatrixD qc = giveQC(wheel, station, sector);
806  if(qc.GetNrows() == 0) return *mat;
807  mat->ResizeTo(12,2);
808  int maxCount = 12;
809  if(station == 4) maxCount = 8;
810  for(int c = 0; c < maxCount; ++c) {
811  float error;
812  if(qc(c,1) == 0 || qc(c,3) == 0) {
813  (*mat)(c,0) = (qc(c,0)+qc(c,2)) /2.0;
814  (*mat)(c,1) = 500;
815  } else {
816  error = 1.0/(1.0/(qc(c,1)*qc(c,1))+1.0/(qc(c,3)*qc(c,3)));
817  (*mat)(c, 0) = (qc(c,0)/(qc(c,1)*qc(c,1))+qc(c,2)/(qc(c,3)*qc(c,3)))*error;
818  (*mat)(c, 1) = TMath::Sqrt(error);
819  }
820  }
821  return *mat;
822 }
TMatrixD giveQC(int, int, int)
Definition: ReadPGInfo.cc:824
TMatrixD ReadPGInfo::giveR ( int  wheel,
int  station,
int  sector 
)

Definition at line 792 of file ReadPGInfo.cc.

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

792  {
793  TMatrixD *empty = new TMatrixD(0,0);
794  char *id = getId(wheel, station, sector);
795  if(id == nullptr) return *empty;
796  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
797  TDirectoryFile *myR = (TDirectoryFile *)myDir->Get("R");
798  TMatrixD *R = (TMatrixD *)myR->Get("matrix");
799  return *R;
800 }
TFile * rootFile
Definition: ReadPGInfo.h:29
char * getId(int, int, int)
Definition: ReadPGInfo.cc:783
TMatrixD ReadPGInfo::giveSurvey ( int  wheel,
int  station,
int  sector 
)

Definition at line 840 of file ReadPGInfo.cc.

References relativeConstraints::empty, getId(), and rootFile.

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

840  {
841  TMatrixD *empty = new TMatrixD(0,0);
842  char *id = getId(wheel, station, sector);
843  if(id == nullptr) return *empty;
844  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
845  TDirectoryFile *mySur = (TDirectoryFile *)myDir->Get("Survey");
846  TMatrixD *Survey = (TMatrixD *)mySur->Get("matrix_layer");
847  return *Survey;
848 }
TFile * rootFile
Definition: ReadPGInfo.h:29
char * getId(int, int, int)
Definition: ReadPGInfo.cc:783

Member Data Documentation

TFile* ReadPGInfo::rootFile
private

Definition at line 29 of file ReadPGInfo.h.

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