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 edm::EDConsumerBase

Public Member Functions

 MoveFlatParamsToDB (const edm::ParameterSet &)
 
 ~MoveFlatParamsToDB ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

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
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 71 of file MoveFlatParamsToDB.cc.

Constructor & Destructor Documentation

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

Definition at line 107 of file MoveFlatParamsToDB.cc.

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

109 {
110  cout<<"Enter MoveFlatParamsToDB"<<endl;
111  //now do what ever initialization is needed
112  inFile = new TFile("data/rpflat_combined.root");
113  if(inFile->IsZombie()) {
114  cout<<"file not found"<<endl;
115  }
116  TList * list = ((TDirectory *)inFile->Get("hiEvtPlaneFlatCalib"))->GetListOfKeys();
117  int indx =0;
118  int cnt = 0;
119  for(int i = 0; i<NumEPNames; i++) {
120  x[i]=0;
121  y[i]=0;
122  xycnt[i]=0;
123  }
124  while(indx >=0 && indx<NumEPNames) {
125  int EPNameIndx = -1;
126  TString name = list->At(indx)->GetName();
127  if(!name.Contains("cent")&&!name.Contains("vtx")&&!name.Contains("MidEtaTrackRescor")) {
128  for(int i = 0; i<NumEPNames; i++) {
129  if(name.CompareTo(EPNames[i])==0) {
130  EPNameIndx = i;
131  break;
132  }
133  }
134  if(EPNameIndx <0) cout<<"A bad reaction plane name has been encountered: "<<name.Data()<<endl;
135  RPNameIndx[cnt]=EPNameIndx;
136  TString sname = name;
137  x[cnt] = (TH1D *) inFile->Get(Form("hiEvtPlaneFlatCalib/%s/x_%s",name.Data(),name.Data()));
138  y[cnt] = (TH1D *) inFile->Get(Form("hiEvtPlaneFlatCalib/%s/y_%s",name.Data(),name.Data()));
139  xycnt[cnt] = (TH1D *) inFile->Get(Form("hiEvtPlaneFlatCalib/%s/cnt_%s",name.Data(),name.Data()));
140  rpname[cnt]=sname;
141  if(!x[cnt]) cout<<"bad x"<<endl;
142  if(!y[cnt]) cout<<"bad y"<<endl;
143  if(!xycnt[cnt]) cout<<"bad cnt"<<endl;
144  if(x[cnt] && xycnt[cnt] && y[cnt]) {
145  x[cnt]->Divide(xycnt[cnt]);
146  y[cnt]->Divide(xycnt[cnt]);
147  }
148  ++cnt;
149  if(cnt>NumEPNames||cnt>50) {
150  cout<<"Maximum number of reaction planes exceeded!"<<endl;
151  break;
152  }
153  }
154 
155  if(list->At(indx)==list->Last())
156  indx = -1;
157  else
158  ++indx;
159  }
160  nRP = cnt;
161  cout<<"nRP = "<<nRP<<endl;
162 }
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 165 of file MoveFlatParamsToDB.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 180 of file MoveFlatParamsToDB.cc.

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

181 {
182  using namespace edm;
183  rpFlat = new RPFlatParams();
184  rpFlat->m_table.reserve(x[0]->GetNbinsX());
185  cout<<"Size of table: "<<x[0]->GetNbinsX()<<endl;
186  for(int j = 0; j<x[0]->GetNbinsX();j++) {
187  RPFlatParams::EP * thisBin = new RPFlatParams::EP();
188  for(int i = 0; i<nRP; i++) {
189  thisBin->x[i] = x[i]->GetBinContent(j+1);
190  thisBin->y[i] = y[i]->GetBinContent(j+1);
191  thisBin->RPNameIndx[i]=RPNameIndx[i];
192  }
193  rpFlat->m_table.push_back(*thisBin);
194  if(thisBin) delete thisBin;
195  }
196  cout<<"Number of RP: "<<nRP<<endl;
198  if(poolDbService.isAvailable())
199  poolDbService->writeOne( rpFlat,poolDbService->beginOfTime(),"HeavyIonRPRcd");
200  cout<<"DONE"<<endl;
201 }
int i
Definition: DBlmapReader.cc:9
std::vector< EP > m_table
Definition: RPFlatParams.h:22
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:16
tuple cout
Definition: gather_cfg.py:121
TH1D * y[NumEPNames]
int RPNameIndx[NumEPNames]
void MoveFlatParamsToDB::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file MoveFlatParamsToDB.cc.

207 {
208 }
void MoveFlatParamsToDB::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 212 of file MoveFlatParamsToDB.cc.

212  {
213 }

Member Data Documentation

TFile* MoveFlatParamsToDB::inFile
private

Definition at line 82 of file MoveFlatParamsToDB.cc.

int MoveFlatParamsToDB::nRP
private

Definition at line 91 of file MoveFlatParamsToDB.cc.

RPFlatParams* MoveFlatParamsToDB::rpFlat
private

Definition at line 90 of file MoveFlatParamsToDB.cc.

string MoveFlatParamsToDB::rpname[NumEPNames]
private

Definition at line 87 of file MoveFlatParamsToDB.cc.

int MoveFlatParamsToDB::RPNameIndx[NumEPNames]
private

Definition at line 88 of file MoveFlatParamsToDB.cc.

int MoveFlatParamsToDB::RPSubEvnt[NumEPNames]
private

Definition at line 89 of file MoveFlatParamsToDB.cc.

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

Definition at line 86 of file MoveFlatParamsToDB.cc.

TH1D* MoveFlatParamsToDB::y[NumEPNames]
private