CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorEventDisplay.cc
Go to the documentation of this file.
4 
5 //***************************************************//
6 //********** CastorEventDisplay: *******************//
7 //********** Author: Dmytro Volyanskyy ************//
8 //********** Date : 04.05.2010 (first version) ******//
9 //***************************************************//
12 
13 //==================================================================//
14 //======================= Constructor ==============================//
15 //==================================================================//
17  ievt_=0;
18 }
19 
20 //==================================================================//
21 //======================= Destructor ==============================//
22 //==================================================================//
24 }
25 
27 }
28 
29 
30 //==========================================================//
31 //========================= setup ==========================//
32 //==========================================================//
33 
35 
37  baseFolder_ = rootFolder_+"CastorEventDisplay";
38 
39 
40  offline_ = ps.getUntrackedParameter<bool>("OfflineMode", false);
41 
42  if(fVerbosity>0) std::cout << "CastorEventDisplay::setup (start)" << std::endl;
43 
46  X_pos=0.; Y_pos=0.; Z_pos=0.;
47  X_pos_maxE=0.; Y_pos_maxE=0.; Z_pos_maxE=0.;
48 
49  if ( m_dbe !=NULL ) {
51 
53  meEVT_ = m_dbe->bookInt("EventDisplay Event Number"); // meEVT_->Fill(ievt_);
54 
56  meCastor3Dhits = m_dbe->book3D("CASTOR 3D hits- cumulative", "CASTOR 3D hits - cumulative", 30, 1420, 1600, 35, -35, 35, 35, -35, 35);
57 
58 
59  if( offline_ ){
60  //-- swap z and y axis
61  TH3F* Castor3Dhits = meCastor3Dhits->getTH3F();
62  Castor3Dhits->GetXaxis()->SetTitle("Z [cm]"); //-- also swap x and z
63  Castor3Dhits->GetYaxis()->SetTitle("X [cm]");
64  Castor3Dhits->GetZaxis()->SetTitle("Y [cm]");
65  }
66 
68  meCastor3DhitsMaxEnergy = m_dbe->book3D("CASTOR 3D hits- event with the largest deposited E", "CASTOR 3D hits- event with the largest deposited E", 30, 1420, 1600, 20, -30, 30, 20, -30, 30); //-- swap z and y axis
69 
70  if( offline_ ){
71  TH3F* Castor3DhitsMaxEnergy = meCastor3DhitsMaxEnergy->getTH3F();
72  Castor3DhitsMaxEnergy->GetXaxis()->SetTitle("Z [cm]"); //-- also swap x and z
73  Castor3DhitsMaxEnergy->GetYaxis()->SetTitle("X [cm]");
74  Castor3DhitsMaxEnergy->GetZaxis()->SetTitle("Y [cm]");
75  Castor3DhitsMaxEnergy->SetDrawOption("LEGO2");
76  }
77 
78  }
79 
80  else{
81  if(fVerbosity>0) std::cout << "CastorEventDisplay::setup - NO DQMStore service" << std::endl;
82  }
83 
84  if(fVerbosity>0) std::cout << "CastorEventDisplay::setup (end)" << std::endl;
85 
86  return;
87 }
88 
89 //==========================================================//
90 //================== processEvent ==========================//
91 //==========================================================//
92 
93 void CastorEventDisplay::processEvent(const CastorRecHitCollection& castorHits, const CaloGeometry& caloGeometry ){
94 
95  if(fVerbosity>0) std::cout << "==>CastorEventDisplay::processEvent !!!"<< std::endl;
96 
98  meEVT_->Fill(ievt_);
99 
100  if(!m_dbe) {
101  if(fVerbosity>0) std::cout <<"CastorEventDisplay::processEvent => DQMStore is not instantiated !!!"<<std::endl;
102  return;
103  }
104 
105  allEnergyEvent=0.;
106 
107 
110 
111  if(castorHits.size()>0)
112  {
113  if(fVerbosity>0) std::cout << "==>CastorEventDisplay::processEvent: castorHits.size()>0 !!!" << std::endl;
114 
116  for (CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter) {
117 
119  energy = CASTORiter->energy();
120 
122  HcalCastorDetId CastorID(CASTORiter->detid().rawId());
123 
125  //const CaloSubdetectorGeometry* subdetectorGeometry=caloGeometry.getSubdetectorGeometry(CastorID) ;
126  //const CaloCellGeometry* cellGeometry = subdetectorGeometry->getGeometry(CastorID) ;
127  //X_pos = cellGeometry->getPosition().x() ; Y_pos = cellGeometry->getPosition().y() ;
128  //Z_pos = cellGeometry->getPosition().z() ;
129 
130  X_pos = caloGeometry.getSubdetectorGeometry(CastorID)->getGeometry(CastorID)->getPosition().x() ;
131  Y_pos = caloGeometry.getSubdetectorGeometry(CastorID)->getGeometry(CastorID)->getPosition().y() ;
132  Z_pos = caloGeometry.getSubdetectorGeometry(CastorID)->getGeometry(CastorID)->getPosition().z() ;
133 
134  if (energy>0){
138  meCastor3Dhits->Fill(std::abs(Z_pos),X_pos,Y_pos, energy);
139  }
140 
141  if(fVerbosity>0) std::cout<<"ENERGY="<< energy <<" X_pos="<< X_pos <<" Y_pos="<< Y_pos <<" Z_pos="<< Z_pos << std::endl;
142  } //-- end of for loop
143 
144 
145  if(fVerbosity>0) std::cout<<"TOTAL ENERGY in an event="<< allEnergyEvent << std::endl;
146 
147 
148 
153  if(fVerbosity>0) std::cout<<"LARGEST ENERGY in an event="<< maxEnergyEvent << std::endl;
154 
156  for (CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter){
157  HcalCastorDetId CastorID_maxE(CASTORiter->detid().rawId());
158  X_pos_maxE = caloGeometry.getSubdetectorGeometry(CastorID_maxE)->getGeometry(CastorID_maxE)->getPosition().x() ;
159  Y_pos_maxE = caloGeometry.getSubdetectorGeometry(CastorID_maxE)->getGeometry(CastorID_maxE)->getPosition().y() ;
160  Z_pos_maxE = caloGeometry.getSubdetectorGeometry(CastorID_maxE)->getGeometry(CastorID_maxE)->getPosition().z() ;
161  meCastor3DhitsMaxEnergy->Fill(std::abs(Z_pos_maxE),X_pos_maxE,Y_pos_maxE, CASTORiter->energy() );
162  }
163  meCastor3DhitsMaxEnergy->getTH3F()->SetOption("BOX");
165  }
166  }
167 
168  else { if(fVerbosity>0) std::cout<<"CastorEventDisplay::processEvent NO Castor RecHits !!!"<<std::endl; }
169 
170 
171  if (showTiming) {
172  cpu_timer.stop(); std::cout << " TIMER::CastorEventDisplay -> " << cpu_timer.cpuTime() << std::endl;
174  }
175 
177  ievt_++;
178 
179  return;
180 }
181 
182 
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
T getUntrackedParameter(std::string const &, T const &) const
edm::CPUTimer cpu_timer
virtual void setup(const edm::ParameterSet &ps, DQMStore *dbe)
void start()
Definition: CPUTimer.cc:74
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:979
std::vector< T >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:62
TH3F * getTH3F(void) const
#define abs(x)
Definition: mlp_lapack.h:159
void reset()
Definition: CPUTimer.cc:107
#define NULL
Definition: scimark2.h:8
MonitorElement * meEVT_
void update(void)
Mark the object updated.
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void Fill(long long x)
std::string baseFolder_
T z() const
Definition: PV3DBase.h:63
MonitorElement * meCastor3DhitsMaxEnergy
Times stop()
Definition: CPUTimer.cc:94
const_iterator end() const
double cpuTime() const
Definition: CPUTimer.cc:157
MonitorElement * meCastor3Dhits
size_type size() const
void processEvent(const CastorRecHitCollection &castorHits, const CaloGeometry &caloGeometry)
std::string rootFolder_
tuple cout
Definition: gather_cfg.py:121
void setup(const edm::ParameterSet &ps, DQMStore *dbe)
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
T x() const
Definition: PV3DBase.h:61
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const_iterator begin() const