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
Inheritance diagram for HiEvtPlaneFlatCalib:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HiEvtPlaneFlatCalib (const edm::ParameterSet &)
 
 ~HiEvtPlaneFlatCalib ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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

edm::Handle< int > cbin_
 
edm::EDGetTokenT< int > ctag_
 
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
 
edm::EDGetTokenT
< reco::VertexCollection
vtxCollection_
 
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
 
- 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

Definition at line 65 of file HiEvtPlaneFlatCalib.cc.

Constructor & Destructor Documentation

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

Definition at line 119 of file HiEvtPlaneFlatCalib.cc.

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

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

Definition at line 175 of file HiEvtPlaneFlatCalib.cc.

176 {
177 
178  // do anything here that needs to be done at desctruction time
179  // (e.g. close files, deallocate resources etc.)
180 
181 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 190 of file HiEvtPlaneFlatCalib.cc.

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

191 {
192  using namespace edm;
193  using namespace reco;
194  //
195  //Get Centrality
196  //
197  iEvent.getByToken(ctag_,cbin_);
198 
199  int bin = *cbin_;
200  double centval = 2.5*bin+1.25;
201  hcent->Fill(bin);
202  //
203  //Get Vertex
204  //
205  edm::Handle<reco::VertexCollection> vertexCollection3;
206  iEvent.getByToken(vtxCollection_,vertexCollection3);
207  const reco::VertexCollection * vertices3 = vertexCollection3.product();
208  vs_sell = vertices3->size();
209  if(vs_sell>0) {
210  vzr_sell = vertices3->begin()->z();
211  vzErr_sell = vertices3->begin()->zError();
212  } else
213  vzr_sell = -999.9;
214  //
215  //Get Flattening Parameters
216  //
217  if(genFlatPsi_) {
218  edm::ESHandle<RPFlatParams> flatparmsDB_;
219  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
220  int flatTableSize = flatparmsDB_->m_table.size();
221  for(int i = 0; i<flatTableSize; i++) {
222  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
223  for(int j = 0; j<NumEPNames; j++) {
224  int indx = thisBin->RPNameIndx[j];
225  if(indx>=0) {
226  flat[indx]->SetXDB(i, thisBin->x[j]);
227  flat[indx]->SetYDB(i, thisBin->y[j]);
228  }
229  }
230  }
231  }
232 
233  //
234  //Get Event Planes
235  //
236 
238  iEvent.getByLabel("hiEvtPlane","recoLevel",evtPlanes);
239 
240  if(!evtPlanes.isValid()){
241  //cout << "Error! Can't get hiEvtPlane product!" << endl;
242  return ;
243  }
244 
245  for (EvtPlaneCollection::const_iterator rp = evtPlanes->begin();rp !=evtPlanes->end(); rp++) {
246  if(rp->angle() > -5) {
247  string baseName = rp->label();
248  for(int i = 0; i< NumEPNames; i++) {
249  if(EPNames[i].compare(baseName)==0) {
250  double psiFlat = flat[i]->GetFlatPsi(rp->angle(),vzr_sell,bin);
251  epang[i]=psiFlat;
252  if(EPNames[i].compare(rp->label())==0) {
253  flat[i]->Fill(rp->angle(),vzr_sell,bin);
254  if(i==0) hvtx->Fill(vzr_sell);
255 
256  if(centval<=80) hPsi[i]->Fill(rp->angle());
257  if(genFlatPsi_) {
258  if(centval<=80) hPsiFlat[i]->Fill(psiFlat);
259  for(int j = 0; j<NumCentBins; j++) {
260  if(centval>wcent[j]&&centval<=wcent[j+1]) hPsiFlatCent[i][j]->Fill(psiFlat);
261  }
262  }
263  }
264  }
265  }
266  }
267  }
268 
269 }
int i
Definition: DBlmapReader.cc:9
static const int NumCentBins
double GetFlatPsi(double psi, double vtx, double cent)
edm::EDGetTokenT< int > ctag_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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)
return((rh^lh)&mask)
void SetYDB(int indx, double val)
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
TH1D * hPsi[NumEPNames]
TH1D * hPsiFlat[NumEPNames]
void Fill(double psi, double vtx, int centbin)
const T & get() const
Definition: EventSetup.h:55
edm::Handle< int > cbin_
int RPNameIndx[50]
Definition: RPFlatParams.h:16
static const int NumEPNames
edm::EDGetTokenT< reco::VertexCollection > vtxCollection_
Double_t epang[NumEPNames]
TH1D * hPsiFlatCent[NumEPNames][NumCentBins]
void HiEvtPlaneFlatCalib::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 273 of file HiEvtPlaneFlatCalib.cc.

274 {
275 }
void HiEvtPlaneFlatCalib::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 279 of file HiEvtPlaneFlatCalib.cc.

References i, j, and hi::NumEPNames.

279  {
280  for(int i = 0; i<NumEPNames; i++) {
281  for(int j = 0; j<flat[i]->GetHBins();j++) {
282  flatXhist[i]->SetBinContent(j+1,flat[i]->GetX(j));
283  flatYhist[i]->SetBinContent(j+1,flat[i]->GetY(j));
284  flatCnthist[i]->SetBinContent(j+1,flat[i]->GetCnt(j));
285  }
286  }
287 }
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

edm::Handle<int> HiEvtPlaneFlatCalib::cbin_
private

Definition at line 78 of file HiEvtPlaneFlatCalib.cc.

edm::EDGetTokenT<int> HiEvtPlaneFlatCalib::ctag_
private

Definition at line 79 of file HiEvtPlaneFlatCalib.cc.

Double_t HiEvtPlaneFlatCalib::epang[NumEPNames]
private

Definition at line 100 of file HiEvtPlaneFlatCalib.cc.

HiEvtPlaneFlatten* HiEvtPlaneFlatCalib::flat[NumEPNames]
private

Definition at line 101 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatCnthist[NumEPNames]
private

Definition at line 91 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatXDBhist[NumEPNames]
private

Definition at line 93 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatXhist[NumEPNames]
private

Definition at line 89 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatYDBhist[NumEPNames]
private

Definition at line 94 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::flatYhist[NumEPNames]
private

Definition at line 90 of file HiEvtPlaneFlatCalib.cc.

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

Definition at line 77 of file HiEvtPlaneFlatCalib.cc.

bool HiEvtPlaneFlatCalib::genFlatPsi_
private

Definition at line 104 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hcent
private

Definition at line 87 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsi[NumEPNames]
private

Definition at line 95 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlat[NumEPNames]
private

Definition at line 96 of file HiEvtPlaneFlatCalib.cc.

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

Definition at line 97 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlatSub1[NumEPNames]
private

Definition at line 98 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hPsiFlatSub2[NumEPNames]
private

Definition at line 99 of file HiEvtPlaneFlatCalib.cc.

TH1D* HiEvtPlaneFlatCalib::hvtx
private

Definition at line 88 of file HiEvtPlaneFlatCalib.cc.

int HiEvtPlaneFlatCalib::nRP
private

Definition at line 103 of file HiEvtPlaneFlatCalib.cc.

const int HiEvtPlaneFlatCalib::NumCentBins =9
staticprivate

Definition at line 84 of file HiEvtPlaneFlatCalib.cc.

RPFlatParams* HiEvtPlaneFlatCalib::rpFlat
private

Definition at line 102 of file HiEvtPlaneFlatCalib.cc.

int HiEvtPlaneFlatCalib::vs_sell
private

Definition at line 80 of file HiEvtPlaneFlatCalib.cc.

edm::EDGetTokenT<reco::VertexCollection> HiEvtPlaneFlatCalib::vtxCollection_
private

Definition at line 76 of file HiEvtPlaneFlatCalib.cc.

float HiEvtPlaneFlatCalib::vzErr_sell
private

Definition at line 82 of file HiEvtPlaneFlatCalib.cc.

float HiEvtPlaneFlatCalib::vzr_sell
private

Definition at line 81 of file HiEvtPlaneFlatCalib.cc.

double HiEvtPlaneFlatCalib::wcent[10]
private

Definition at line 85 of file HiEvtPlaneFlatCalib.cc.