CMS 3D CMS Logo

Public Member Functions | Private Attributes

ReadPGInfo Class Reference

#include <ReadPGInfo.h>

List of all members.

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/03/29 13:18:43
Revision:
1.4
Author:
Luca Scodellaro <Luca.Scodellaro@cern.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.

                                       {
  TDirectory * dirSave = gDirectory;
  rootFile = new TFile(name);
  dirSave->cd();
}
ReadPGInfo::~ReadPGInfo ( )

Definition at line 781 of file ReadPGInfo.cc.

References rootFile.

{delete rootFile;}

Member Function Documentation

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

Definition at line 783 of file ReadPGInfo.cc.

References chambers, NULL, position, and TOTALCHAMBERS.

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

                                                           {
  for(int counter = 0; counter < TOTALCHAMBERS; ++counter) {
    if(wheel == position[counter][0] && sector == position[counter][1] && station == position[counter][2])
      return chambers[counter];
  }
  return NULL;
}
TMatrixD ReadPGInfo::giveQC ( int  wheel,
int  station,
int  sector 
)

Definition at line 824 of file ReadPGInfo.cc.

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

Referenced by giveQCCal().

                                                              {
  TMatrixD *empty = new TMatrixD(0,0);
  char *id = getId(wheel, station, sector);
  if(id == NULL) return *empty;
  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
  TDirectoryFile *myQC = (TDirectoryFile *)myDir->Get("QCW");
  TMatrixD *QC;
  if(myQC == NULL) {
    QC = new TMatrixD(0,0);
  } else {
    QC = (TMatrixD *)myQC->Get("matrix");
  }
  return *QC;
}
TMatrixD ReadPGInfo::giveQCCal ( int  wheel,
int  station,
int  sector 
)

Definition at line 803 of file ReadPGInfo.cc.

References trackerHits::c, error, and giveQC().

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

                                                                 {
  TMatrixD *mat = new TMatrixD(0,0);
  TMatrixD qc = giveQC(wheel, station, sector);
  if(qc.GetNrows() == 0) return *mat;
  mat->ResizeTo(12,2);
  int maxCount = 12;
  if(station == 4) maxCount = 8;
  for(int c = 0; c < maxCount; ++c) {
    float error;
    if(qc(c,1) == 0 || qc(c,3) == 0) {
      (*mat)(c,0) = (qc(c,0)+qc(c,2)) /2.0;
      (*mat)(c,1) = 500;
    } else {  
      error = 1.0/(1.0/(qc(c,1)*qc(c,1))+1.0/(qc(c,3)*qc(c,3)));
     (*mat)(c, 0) = (qc(c,0)/(qc(c,1)*qc(c,1))+qc(c,2)/(qc(c,3)*qc(c,3)))*error;
     (*mat)(c, 1) = TMath::Sqrt(error);
    }
  }
  return *mat;
}
TMatrixD ReadPGInfo::giveR ( int  wheel,
int  station,
int  sector 
)

Definition at line 792 of file ReadPGInfo.cc.

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

                                                             {
  TMatrixD *empty = new TMatrixD(0,0);
  char *id = getId(wheel, station, sector);
  if(id == NULL) return *empty;
  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
  TDirectoryFile *myR = (TDirectoryFile *)myDir->Get("R");
  TMatrixD *R = (TMatrixD *)myR->Get("matrix");
  return *R;
}
TMatrixD ReadPGInfo::giveSurvey ( int  wheel,
int  station,
int  sector 
)

Definition at line 840 of file ReadPGInfo.cc.

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

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

                                                                  {
  TMatrixD *empty = new TMatrixD(0,0);
  char *id = getId(wheel, station, sector);
  if(id == NULL) return *empty;
  TDirectoryFile *myDir = (TDirectoryFile *)rootFile->Get(id);
  TDirectoryFile *mySur = (TDirectoryFile *)myDir->Get("Survey");
  TMatrixD *Survey = (TMatrixD *)mySur->Get("matrix_layer");
  return *Survey;
}

Member Data Documentation

TFile* ReadPGInfo::rootFile [private]

Definition at line 29 of file ReadPGInfo.h.

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