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 | Static Private Attributes
HiEvtPlaneFlatCalib Class Reference

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

Inheritance diagram for HiEvtPlaneFlatCalib:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HiEvtPlaneFlatCalib (const edm::ParameterSet &)
 
 ~HiEvtPlaneFlatCalib ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

CentralityProvidercentrality_
 
Double_t epang [NumEPNames]
 
HiEvtPlaneFlattenflat [NumEPNames]
 
TH1D * flatCnthist [NumEPNames]
 
TH1D * flatXDBhist [NumEPNames]
 
TH1D * flatXhist [NumEPNames]
 
TH1D * flatYDBhist [NumEPNames]
 
TH1D * flatYhist [NumEPNames]
 
edm::Service< TFileServicefs
 
bool genFlatPsi_
 
TH1D * hcent
 
TH1D * hPsi [NumEPNames]
 
TH1D * hPsiFlat [NumEPNames]
 
TH1D * hPsiFlatCent [NumEPNames][NumCentBins]
 
TH1D * hPsiFlatSub1 [NumEPNames]
 
TH1D * hPsiFlatSub2 [NumEPNames]
 
TH1D * hvtx
 
int nRP
 
RPFlatParamsrpFlat
 
int vs_sell
 
float vzErr_sell
 
float vzr_sell
 
double wcent [10]
 

Static Private Attributes

static const int NumCentBins =9
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 79 of file HiEvtPlaneFlatCalib.cc.

Constructor & Destructor Documentation

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

Definition at line 132 of file HiEvtPlaneFlatCalib.cc.

References data, hi::EPNames, hi::EPOrder, edm::ParameterSet::getUntrackedParameter(), i, j, TFileDirectory::make(), TFileDirectory::mkdir(), pileupCalc::nbins, and hi::NumEPNames.

133 {
134  genFlatPsi_ = iConfig.getUntrackedParameter<bool>("genFlatPsi_",true);
135 
136  // NumCentBins=9;
137  wcent[0] = 0;
138  wcent[1] = 5;
139  wcent[2] = 10;
140  wcent[3] = 20;
141  wcent[4] = 30;
142  wcent[5] = 40;
143  wcent[6] = 50;
144  wcent[7] = 60;
145  wcent[8] = 70;
146  wcent[9] = 100;
147 
148  //now do what ever other initialization is needed
149  // cbins_ = 0;
150  centrality_ = 0;
151  hcent = fs->make<TH1D>("cent","cent",41,0,40);
152  hvtx = fs->make<TH1D>("vtx","vtx",1000,-50,50);
153  //setting before 8:35 CDT on 11Jan2011
154  Int_t FlatOrder = 21;
155  for(int i = 0; i<NumEPNames; i++) {
156  TFileDirectory subdir = fs->mkdir(Form("%s",EPNames[i].data()));
157  flat[i] = new HiEvtPlaneFlatten();
158  flat[i]->Init(FlatOrder,11,4,EPNames[i],EPOrder[i]);
159  int nbins = flat[i]->GetHBins();
160  flatXhist[i] = subdir.make<TH1D>(Form("x_%s",EPNames[i].data()),Form("x_%s",EPNames[i].data()),nbins,-0.5,nbins-0.5);
161  flatYhist[i] = subdir.make<TH1D>(Form("y_%s",EPNames[i].data()),Form("y_%s",EPNames[i].data()),nbins,-0.5,nbins-0.5);
162  flatCnthist[i] = subdir.make<TH1D>(Form("cnt_%s",EPNames[i].data()),Form("cnt_%s",EPNames[i].data()),nbins,-0.5,nbins-0.5);
163  Double_t psirange = 4;
164  if(EPOrder[i]==2 ) psirange = 2;
165  if(EPOrder[i]==3 ) psirange = 1.5;
166  if(EPOrder[i]==4 ) psirange = 1;
167  if(EPOrder[i]==5) psirange = 0.8;
168  if(EPOrder[i]==6) psirange = 0.6;
169  hPsi[i] = subdir.make<TH1D>("psi","psi",800,-psirange,psirange);
170  hPsi[i]->SetXTitle("#Psi");
171  hPsi[i]->SetYTitle(Form("Counts (cent<80%c)",'%'));
172  hPsiFlat[i] = subdir.make<TH1D>("psiFlat","psiFlat",800,-psirange,psirange);
173  hPsiFlat[i]->SetXTitle("#Psi");
174  hPsiFlat[i]->SetYTitle(Form("Counts (cent<80%c)",'%'));
175  for(int j = 0; j<NumCentBins; j++) {
176  TString hname = Form("psiFlat_%d_%d",(int) wcent[j],(int) wcent[j+1]);
177  hPsiFlatCent[i][j] = subdir.make<TH1D>(hname.Data(),hname.Data(),800,-psirange,psirange);
178  hPsiFlatCent[i][j]->SetXTitle("#Psi");
179  hPsiFlatCent[i][j]->SetYTitle(Form("Counts (%d<cent#leq%d%c)",(int) wcent[j],(int) wcent[j+1],'%'));
180  }
181 
182  }
183 
184 }
T getUntrackedParameter(std::string const &, T const &) const
const int EPOrder[]
int i
Definition: DBlmapReader.cc:9
static const int NumCentBins
TH1D * flatYhist[NumEPNames]
void Init(int order, int ncentbins, const int centbinCompression, std::string tag, int vord)
const std::string EPNames[]
HiEvtPlaneFlatten * flat[NumEPNames]
TH1D * flatXhist[NumEPNames]
TH1D * flatCnthist[NumEPNames]
int j
Definition: DBlmapReader.cc:9
TH1D * hPsi[NumEPNames]
TH1D * hPsiFlat[NumEPNames]
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
T * make() const
make new ROOT object
static const int NumEPNames
TH1D * hPsiFlatCent[NumEPNames][NumCentBins]
CentralityProvider * centrality_
edm::Service< TFileService > fs
HiEvtPlaneFlatCalib::~HiEvtPlaneFlatCalib ( )

Definition at line 187 of file HiEvtPlaneFlatCalib.cc.

188 {
189 
190  // do anything here that needs to be done at desctruction time
191  // (e.g. close files, deallocate resources etc.)
192 
193 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 202 of file HiEvtPlaneFlatCalib.cc.

References newFWLiteAna::bin, compare_using_db::compare, hi::EPNames, edm::EventSetup::get(), edm::Event::getByLabel(), i, j, hi::NumEPNames, L1Trigger_dataformats::reco, hitfit::return, RPFlatParams::EP::RPNameIndx, RPFlatParams::EP::x, and RPFlatParams::EP::y.

203 {
204  using namespace edm;
205  using namespace reco;
206  //
207  //Get Centrality
208  //
209  if(!centrality_) centrality_ = new CentralityProvider(iSetup);
210 
211  centrality_->newEvent(iEvent,iSetup); // make sure you do this first in every event
212  int bin = centrality_->getBin();
213  double centval = 2.5*bin+1.25;
214  hcent->Fill(bin);
215  //
216  //Get Vertex
217  //
218  edm::Handle<reco::VertexCollection> vertexCollection3;
219  iEvent.getByLabel("hiSelectedVertex",vertexCollection3);
220  const reco::VertexCollection * vertices3 = vertexCollection3.product();
221  vs_sell = vertices3->size();
222  if(vs_sell>0) {
223  vzr_sell = vertices3->begin()->z();
224  vzErr_sell = vertices3->begin()->zError();
225  } else
226  vzr_sell = -999.9;
227  //
228  //Get Flattening Parameters
229  //
230  if(genFlatPsi_) {
231  edm::ESHandle<RPFlatParams> flatparmsDB_;
232  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
233  int flatTableSize = flatparmsDB_->m_table.size();
234  for(int i = 0; i<flatTableSize; i++) {
235  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
236  for(int j = 0; j<NumEPNames; j++) {
237  int indx = thisBin->RPNameIndx[j];
238  if(indx>=0) {
239  flat[indx]->SetXDB(i, thisBin->x[j]);
240  flat[indx]->SetYDB(i, thisBin->y[j]);
241  }
242  }
243  }
244  }
245 
246  //
247  //Get Event Planes
248  //
249 
251  iEvent.getByLabel("hiEvtPlane","recoLevel",evtPlanes);
252 
253  if(!evtPlanes.isValid()){
254  //cout << "Error! Can't get hiEvtPlane product!" << endl;
255  return ;
256  }
257 
258  for (EvtPlaneCollection::const_iterator rp = evtPlanes->begin();rp !=evtPlanes->end(); rp++) {
259  if(rp->angle() > -5) {
260  string baseName = rp->label();
261  for(int i = 0; i< NumEPNames; i++) {
262  if(EPNames[i].compare(baseName)==0) {
263  double psiFlat = flat[i]->GetFlatPsi(rp->angle(),vzr_sell,bin);
264  epang[i]=psiFlat;
265  if(EPNames[i].compare(rp->label())==0) {
266  flat[i]->Fill(rp->angle(),vzr_sell,bin);
267  if(i==0) hvtx->Fill(vzr_sell);
268 
269  if(centval<=80) hPsi[i]->Fill(rp->angle());
270  if(genFlatPsi_) {
271  if(centval<=80) hPsiFlat[i]->Fill(psiFlat);
272  for(int j = 0; j<NumCentBins; j++) {
273  if(centval>wcent[j]&&centval<=wcent[j+1]) hPsiFlatCent[i][j]->Fill(psiFlat);
274  }
275  }
276  }
277  }
278  }
279  }
280  }
281 
282 }
int i
Definition: DBlmapReader.cc:9
static const int NumCentBins
double GetFlatPsi(double psi, double vtx, double cent)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const std::string EPNames[]
HiEvtPlaneFlatten * flat[NumEPNames]
void SetXDB(int indx, double val)
void SetYDB(int indx, double val)
void newEvent(const edm::Event &ev, const edm::EventSetup &iSetup)
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
TH1D * hPsi[NumEPNames]
TH1D * hPsiFlat[NumEPNames]
void Fill(double psi, double vtx, int centbin)
const T & get() const
Definition: EventSetup.h:55
int RPNameIndx[50]
Definition: RPFlatParams.h:14
static const int NumEPNames
Double_t epang[NumEPNames]
TH1D * hPsiFlatCent[NumEPNames][NumCentBins]
CentralityProvider * centrality_
void HiEvtPlaneFlatCalib::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 286 of file HiEvtPlaneFlatCalib.cc.

287 {
288 }
void HiEvtPlaneFlatCalib::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 292 of file HiEvtPlaneFlatCalib.cc.

References i, j, and hi::NumEPNames.

292  {
293  for(int i = 0; i<NumEPNames; i++) {
294  for(int j = 0; j<flat[i]->GetHBins();j++) {
295  flatXhist[i]->SetBinContent(j+1,flat[i]->GetX(j));
296  flatYhist[i]->SetBinContent(j+1,flat[i]->GetY(j));
297  flatCnthist[i]->SetBinContent(j+1,flat[i]->GetCnt(j));
298  }
299  }
300 }
int i
Definition: DBlmapReader.cc:9
TH1D * flatYhist[NumEPNames]
HiEvtPlaneFlatten * flat[NumEPNames]
TH1D * flatXhist[NumEPNames]
TH1D * flatCnthist[NumEPNames]
int j
Definition: DBlmapReader.cc:9
static const int NumEPNames

Member Data Documentation

CentralityProvider* HiEvtPlaneFlatCalib::centrality_
private

Definition at line 92 of file HiEvtPlaneFlatCalib.cc.

Double_t HiEvtPlaneFlatCalib::epang[NumEPNames]
private

Definition at line 113 of file HiEvtPlaneFlatCalib.cc.

HiEvtPlaneFlatten* HiEvtPlaneFlatCalib::flat[NumEPNames]
private

Definition at line 114 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatCnthist[NumEPNames]
private

Definition at line 104 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatXDBhist[NumEPNames]
private

Definition at line 106 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatXhist[NumEPNames]
private

Definition at line 102 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatYDBhist[NumEPNames]
private

Definition at line 107 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatYhist[NumEPNames]
private

Definition at line 103 of file HiEvtPlaneFlatCalib.cc.

edm::Service<TFileService> HiEvtPlaneFlatCalib::fs
private

Definition at line 90 of file HiEvtPlaneFlatCalib.cc.

bool HiEvtPlaneFlatCalib::genFlatPsi_
private

Definition at line 117 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hcent
private

Definition at line 100 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsi[NumEPNames]
private

Definition at line 108 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlat[NumEPNames]
private

Definition at line 109 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlatCent[NumEPNames][NumCentBins]
private

Definition at line 110 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlatSub1[NumEPNames]
private

Definition at line 111 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlatSub2[NumEPNames]
private

Definition at line 112 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hvtx
private

Definition at line 101 of file HiEvtPlaneFlatCalib.cc.

int HiEvtPlaneFlatCalib::nRP
private

Definition at line 116 of file HiEvtPlaneFlatCalib.cc.

const int HiEvtPlaneFlatCalib::NumCentBins =9
staticprivate

Definition at line 97 of file HiEvtPlaneFlatCalib.cc.

RPFlatParams* HiEvtPlaneFlatCalib::rpFlat
private

Definition at line 115 of file HiEvtPlaneFlatCalib.cc.

int HiEvtPlaneFlatCalib::vs_sell
private

Definition at line 93 of file HiEvtPlaneFlatCalib.cc.

float HiEvtPlaneFlatCalib::vzErr_sell
private

Definition at line 95 of file HiEvtPlaneFlatCalib.cc.

float HiEvtPlaneFlatCalib::vzr_sell
private

Definition at line 94 of file HiEvtPlaneFlatCalib.cc.

double HiEvtPlaneFlatCalib::wcent[10]
private

Definition at line 98 of file HiEvtPlaneFlatCalib.cc.