CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
MoveFlatParamsToDB Class Reference

#include <HiEvtPlaneFlatten/MoveFlatParamsToDB/src/MoveFlatParamsToDB.cc>

Inheritance diagram for MoveFlatParamsToDB:
edm::EDAnalyzer

Public Member Functions

 MoveFlatParamsToDB (const edm::ParameterSet &)
 
 ~MoveFlatParamsToDB ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

TFile * inFile
 
int nRP
 
RPFlatParamsrpFlat
 
string rpname [NumEPNames]
 
int RPNameIndx [NumEPNames]
 
int RPSubEvnt [NumEPNames]
 
TH1D * x [NumEPNames]
 
TH1D * xycnt [NumEPNames]
 
TH1D * y [NumEPNames]
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 72 of file MoveFlatParamsToDB.cc.

Constructor & Destructor Documentation

MoveFlatParamsToDB::MoveFlatParamsToDB ( const edm::ParameterSet iConfig)
explicit

Definition at line 108 of file MoveFlatParamsToDB.cc.

References gather_cfg::cout, hi::EPNames, i, list(), mergeVDriftHistosByStation::name, hi::NumEPNames, lumiContext::sname, vdt::x, and detailsBasic3DVector::y.

110 {
111  cout<<"Enter MoveFlatParamsToDB"<<endl;
112  //now do what ever initialization is needed
113  inFile = new TFile("data/rpflat_combined.root");
114  if(inFile->IsZombie()) {
115  cout<<"file not found"<<endl;
116  }
117  TList * list = ((TDirectory *)inFile->Get("hiEvtPlaneFlatCalib"))->GetListOfKeys();
118  int indx =0;
119  int cnt = 0;
120  for(int i = 0; i<NumEPNames; i++) {
121  x[i]=0;
122  y[i]=0;
123  xycnt[i]=0;
124  }
125  while(indx >=0 && indx<NumEPNames) {
126  int EPNameIndx = -1;
127  TString name = list->At(indx)->GetName();
128  if(!name.Contains("cent")&&!name.Contains("vtx")&&!name.Contains("MidEtaTrackRescor")) {
129  for(int i = 0; i<NumEPNames; i++) {
130  if(name.CompareTo(EPNames[i])==0) {
131  EPNameIndx = i;
132  break;
133  }
134  }
135  if(EPNameIndx <0) cout<<"A bad reaction plane name has been encountered: "<<name.Data()<<endl;
136  RPNameIndx[cnt]=EPNameIndx;
137  TString sname = name;
138  x[cnt] = (TH1D *) inFile->Get(Form("hiEvtPlaneFlatCalib/%s/x_%s",name.Data(),name.Data()));
139  y[cnt] = (TH1D *) inFile->Get(Form("hiEvtPlaneFlatCalib/%s/y_%s",name.Data(),name.Data()));
140  xycnt[cnt] = (TH1D *) inFile->Get(Form("hiEvtPlaneFlatCalib/%s/cnt_%s",name.Data(),name.Data()));
141  rpname[cnt]=sname;
142  if(!x[cnt]) cout<<"bad x"<<endl;
143  if(!y[cnt]) cout<<"bad y"<<endl;
144  if(!xycnt[cnt]) cout<<"bad cnt"<<endl;
145  if(x[cnt] && xycnt[cnt] && y[cnt]) {
146  x[cnt]->Divide(xycnt[cnt]);
147  y[cnt]->Divide(xycnt[cnt]);
148  }
149  ++cnt;
150  if(cnt>NumEPNames||cnt>50) {
151  cout<<"Maximum number of reaction planes exceeded!"<<endl;
152  break;
153  }
154  }
155 
156  if(list->At(indx)==list->Last())
157  indx = -1;
158  else
159  ++indx;
160  }
161  nRP = cnt;
162  cout<<"nRP = "<<nRP<<endl;
163 }
int i
Definition: DBlmapReader.cc:9
const std::string EPNames[]
TH1D * xycnt[NumEPNames]
string rpname[NumEPNames]
TH1D * x[NumEPNames]
tuple cout
Definition: gather_cfg.py:121
static const int NumEPNames
TH1D * y[NumEPNames]
int RPNameIndx[NumEPNames]
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
MoveFlatParamsToDB::~MoveFlatParamsToDB ( )

Definition at line 166 of file MoveFlatParamsToDB.cc.

167 {
168 
169  // do anything here that needs to be done at desctruction time
170  // (e.g. close files, deallocate resources etc.)
171 
172 }

Member Function Documentation

void MoveFlatParamsToDB::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 181 of file MoveFlatParamsToDB.cc.

References gather_cfg::cout, i, j, RPFlatParams::EP::RPNameIndx, cond::service::PoolDBOutputService::writeOne(), RPFlatParams::EP::x, vdt::x, RPFlatParams::EP::y, and detailsBasic3DVector::y.

182 {
183  using namespace edm;
184  rpFlat = new RPFlatParams();
185  rpFlat->m_table.reserve(x[0]->GetNbinsX());
186  cout<<"Size of table: "<<x[0]->GetNbinsX()<<endl;
187  for(int j = 0; j<x[0]->GetNbinsX();j++) {
188  RPFlatParams::EP * thisBin = new RPFlatParams::EP();
189  for(int i = 0; i<nRP; i++) {
190  thisBin->x[i] = x[i]->GetBinContent(j+1);
191  thisBin->y[i] = y[i]->GetBinContent(j+1);
192  thisBin->RPNameIndx[i]=RPNameIndx[i];
193  }
194  rpFlat->m_table.push_back(*thisBin);
195  if(thisBin) delete thisBin;
196  }
197  cout<<"Number of RP: "<<nRP<<endl;
199  if(poolDbService.isAvailable())
200  poolDbService->writeOne( rpFlat,poolDbService->beginOfTime(),"HeavyIonRPRcd");
201  cout<<"DONE"<<endl;
202 }
int i
Definition: DBlmapReader.cc:9
std::vector< EP > m_table
Definition: RPFlatParams.h:18
int j
Definition: DBlmapReader.cc:9
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
TH1D * x[NumEPNames]
int RPNameIndx[50]
Definition: RPFlatParams.h:14
tuple cout
Definition: gather_cfg.py:121
TH1D * y[NumEPNames]
int RPNameIndx[NumEPNames]
void MoveFlatParamsToDB::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 207 of file MoveFlatParamsToDB.cc.

208 {
209 }
void MoveFlatParamsToDB::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 213 of file MoveFlatParamsToDB.cc.

213  {
214 }

Member Data Documentation

TFile* MoveFlatParamsToDB::inFile
private

Definition at line 83 of file MoveFlatParamsToDB.cc.

int MoveFlatParamsToDB::nRP
private

Definition at line 92 of file MoveFlatParamsToDB.cc.

RPFlatParams* MoveFlatParamsToDB::rpFlat
private

Definition at line 91 of file MoveFlatParamsToDB.cc.

string MoveFlatParamsToDB::rpname[NumEPNames]
private

Definition at line 88 of file MoveFlatParamsToDB.cc.

int MoveFlatParamsToDB::RPNameIndx[NumEPNames]
private

Definition at line 89 of file MoveFlatParamsToDB.cc.

int MoveFlatParamsToDB::RPSubEvnt[NumEPNames]
private

Definition at line 90 of file MoveFlatParamsToDB.cc.

TH1D* MoveFlatParamsToDB::x[NumEPNames]
private
TH1D* MoveFlatParamsToDB::xycnt[NumEPNames]
private

Definition at line 87 of file MoveFlatParamsToDB.cc.

TH1D* MoveFlatParamsToDB::y[NumEPNames]
private