CMS 3D CMS Logo

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

#include <EcalPreshowerSimHitsValidation.h>

Inheritance diagram for EcalPreshowerSimHitsValidation:
edm::EDAnalyzer

Public Member Functions

 EcalPreshowerSimHitsValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalPreshowerSimHitsValidation ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 
void endJob (void)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Types

typedef std::map< uint32_t,
float, std::less< uint32_t > > 
MapType
 

Private Attributes

DQMStoredbe_
 
std::string EEHitsCollection
 
std::string ESHitsCollection
 
std::string g4InfoLabel
 
std::string HepMCLabel
 
MonitorElementme2eszmOver1eszm_
 
MonitorElementme2eszpOver1eszp_
 
MonitorElementmeE1alphaE2zm_
 
MonitorElementmeE1alphaE2zp_
 
MonitorElementmeEEoverESzm_
 
MonitorElementmeEEoverESzp_
 
MonitorElementmeESEnergyHits1zm_
 
MonitorElementmeESEnergyHits1zp_
 
MonitorElementmeESEnergyHits2zm_
 
MonitorElementmeESEnergyHits2zp_
 
MonitorElementmeEShitLog10Energy_
 
MonitorElementmeEShitLog10EnergyNorm_
 
MonitorElementmenESHits1zm_
 
MonitorElementmenESHits1zp_
 
MonitorElementmenESHits2zm_
 
MonitorElementmenESHits2zp_
 
std::string outputFile_
 
bool verbose_
 

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 &)
 

Detailed Description

Definition at line 37 of file EcalPreshowerSimHitsValidation.h.

Member Typedef Documentation

typedef std::map<uint32_t,float,std::less<uint32_t> > EcalPreshowerSimHitsValidation::MapType
private

Definition at line 39 of file EcalPreshowerSimHitsValidation.h.

Constructor & Destructor Documentation

EcalPreshowerSimHitsValidation::EcalPreshowerSimHitsValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 18 of file EcalPreshowerSimHitsValidation.cc.

References dbe_, edm::ParameterSet::getUntrackedParameter(), interpolateCardsSimple::histo, me2eszmOver1eszm_, me2eszpOver1eszp_, meE1alphaE2zm_, meE1alphaE2zp_, meEEoverESzm_, meEEoverESzp_, meESEnergyHits1zm_, meESEnergyHits1zp_, meESEnergyHits2zm_, meESEnergyHits2zp_, meEShitLog10Energy_, meEShitLog10EnergyNorm_, menESHits1zm_, menESHits1zp_, menESHits2zm_, menESHits2zp_, cppFunctionSkipper::operator, and verbose_.

18  :
19 
20  HepMCLabel(ps.getParameter<std::string>("moduleLabelMC")),
21  g4InfoLabel(ps.getParameter<std::string>("moduleLabelG4")),
22  EEHitsCollection(ps.getParameter<std::string>("EEHitsCollection")),
23  ESHitsCollection(ps.getParameter<std::string>("ESHitsCollection")){
24 
25  // verbosity switch
26  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
27 
28  // get hold of back-end interface
29  dbe_ = 0;
30  dbe_ = edm::Service<DQMStore>().operator->();
31  if ( dbe_ ) {
32  if ( verbose_ ) { dbe_->setVerbose(1); }
33  else { dbe_->setVerbose(0); }
34  }
35 
36  if ( dbe_ ) {
37  if ( verbose_ ) dbe_->showDirStructure();
38  }
39 
40 
41  menESHits1zp_ = 0;
42  menESHits2zp_ = 0;
43  menESHits1zm_ = 0;
44  menESHits2zm_ = 0;
45 
50 
53 
54  meE1alphaE2zp_ = 0;
55  meE1alphaE2zm_ = 0;
56  meEEoverESzp_ = 0;
57  meEEoverESzm_ = 0;
58 
61 
62 
63  Char_t histo[200];
64 
65  if ( dbe_ ) {
66  dbe_->setCurrentFolder("EcalHitsV/EcalSimHitsValidation");
67 
68  sprintf (histo, "ES hits layer 1 multiplicity z+" ) ;
69  menESHits1zp_ = dbe_->book1D(histo, histo, 50, 0., 50. ) ;
70 
71  sprintf (histo, "ES hits layer 2 multiplicity z+" ) ;
72  menESHits2zp_ = dbe_->book1D(histo, histo, 50, 0., 50. ) ;
73 
74  sprintf (histo, "ES hits layer 1 multiplicity z-" ) ;
75  menESHits1zm_ = dbe_->book1D(histo, histo, 50, 0., 50. ) ;
76 
77  sprintf (histo, "ES hits layer 2 multiplicity z-" ) ;
78  menESHits2zm_ = dbe_->book1D(histo, histo, 50, 0., 50. ) ;
79 
80  sprintf (histo, "ES hits energy layer 1 z+" ) ;
81  meESEnergyHits1zp_ = dbe_->book1D(histo, histo, 100, 0., 0.05 ) ;
82 
83  sprintf (histo, "ES hits energy layer 2 z+" ) ;
84  meESEnergyHits2zp_ = dbe_->book1D(histo, histo, 100, 0., 0.05 ) ;
85 
86  sprintf (histo, "ES hits energy layer 1 z-" ) ;
87  meESEnergyHits1zm_ = dbe_->book1D(histo, histo, 100, 0., 0.05 ) ;
88 
89  sprintf (histo, "ES hits energy layer 2 z-" ) ;
90  meESEnergyHits2zm_ = dbe_->book1D(histo, histo, 100, 0., 0.05 ) ;
91 
92  sprintf (histo, "ES hits log10energy spectrum" );
93  meEShitLog10Energy_ = dbe_->book1D(histo, histo, 140, -10., 4.);
94 
95  sprintf (histo, "ES hits log10energy spectrum vs normalized energy" );
96  meEShitLog10EnergyNorm_ = dbe_->bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
97 
98  sprintf (histo, "ES E1+07E2 z+" ) ;
99  meE1alphaE2zp_ = dbe_->book1D(histo, histo, 100, 0., 0.05);
100 
101  sprintf (histo, "ES E1+07E2 z-" ) ;
102  meE1alphaE2zm_ = dbe_->book1D(histo, histo, 100, 0., 0.05);
103 
104  sprintf (histo, "EE vs ES z+" ) ;
105  meEEoverESzp_ = dbe_->bookProfile(histo, histo, 250, 0., 500., 200, 0., 200.);
106 
107  sprintf (histo, "EE vs ES z-" ) ;
108  meEEoverESzm_ = dbe_->bookProfile(histo, histo, 250, 0., 500., 200, 0., 200.);
109 
110  sprintf (histo, "ES ene2oEne1 z+" ) ;
111  me2eszpOver1eszp_ = dbe_->book1D(histo, histo, 50, 0., 10.);
112 
113  sprintf (histo, "ES ene2oEne1 z-" ) ;
114  me2eszmOver1eszm_ = dbe_->book1D(histo, histo, 50, 0., 10.);
115  }
116 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
void showDirStructure(void) const
Definition: DQMStore.cc:2761
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
EcalPreshowerSimHitsValidation::~EcalPreshowerSimHitsValidation ( )

Destructor.

Definition at line 118 of file EcalPreshowerSimHitsValidation.cc.

118  {
119 
120 }

Member Function Documentation

void EcalPreshowerSimHitsValidation::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 130 of file EcalPreshowerSimHitsValidation.cc.

References EEHitsCollection, ESHitsCollection, edm::EventID::event(), MonitorElement::Fill(), g4InfoLabel, edm::Event::getByLabel(), HepMCLabel, i, edm::EventBase::id(), edm::HandleBase::isValid(), create_public_lumi_plots::log, LogDebug, me2eszmOver1eszm_, me2eszpOver1eszp_, meE1alphaE2zm_, meE1alphaE2zp_, meEEoverESzm_, meEEoverESzp_, meESEnergyHits1zm_, meESEnergyHits1zp_, meESEnergyHits2zm_, meESEnergyHits2zp_, meEShitLog10Energy_, meEShitLog10EnergyNorm_, menESHits1zm_, menESHits1zp_, menESHits2zm_, menESHits2zp_, AlCaHLTBitMon_ParallelJobs::p, edm::EventID::run(), and funct::tan().

130  {
131 
132  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
133 
135  e.getByLabel(HepMCLabel, MCEvt);
136 
139 
142 
143  std::vector<PCaloHit> theEECaloHits;
144  if( EcalHitsEE.isValid() ) {
145  theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
146  }
147 
148  std::vector<PCaloHit> theESCaloHits;
149  if( EcalHitsES.isValid() ) {
150  theESCaloHits.insert(theESCaloHits.end(), EcalHitsES->begin(), EcalHitsES->end());
151  }
152 
153  double ESEnergy_ = 0.;
154  //std::map<unsigned int, std::vector<PCaloHit>,std::less<unsigned int> > CaloHitMap;
155 
156  // endcap
157  double EEetzp_ = 0.;
158  double EEetzm_ = 0.;
159  for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim){
160  EEDetId eeid (isim->id()) ;
161  if (eeid.zside() > 0 ) EEetzp_ += isim->energy();
162  if (eeid.zside() < 0 ) EEetzm_ += isim->energy();
163  }
164 
165 
166  uint32_t nESHits1zp = 0;
167  uint32_t nESHits1zm = 0;
168  uint32_t nESHits2zp = 0;
169  uint32_t nESHits2zm = 0;
170  double ESet1zp_ = 0.;
171  double ESet2zp_ = 0.;
172  double ESet1zm_ = 0.;
173  double ESet2zm_ = 0.;
174  std::vector<double> econtr(140, 0. );
175 
176  for (std::vector<PCaloHit>::iterator isim = theESCaloHits.begin();
177  isim != theESCaloHits.end(); ++isim){
178  //CaloHitMap[(*isim).id()].push_back((*isim));
179 
180  ESDetId esid (isim->id()) ;
181 
182  LogDebug("HitInfo")
183  << " CaloHit " << isim->getName() << "\n"
184  << " DetID = "<<isim->id()<< " ESDetId: z side " << esid.zside() << " plane " << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
185  << " Time = " << isim->time() << "\n"
186  << " Track Id = " << isim->geantTrackId() << "\n"
187  << " Energy = " << isim->energy();
188 
189  ESEnergy_ += isim->energy();
190  if( isim->energy() > 0 ) {
191  meEShitLog10Energy_->Fill(log10(isim->energy()));
192  int log10i = int( ( log10(isim->energy()) + 10. ) * 10. );
193  if( log10i >=0 && log10i < 140 ) econtr[log10i] += isim->energy();
194  }
195 
196  if (esid.plane() == 1 ) {
197  if (esid.zside() > 0 ) {
198  nESHits1zp++ ;
199  ESet1zp_ += isim->energy();
200  if (meESEnergyHits1zp_) meESEnergyHits1zp_->Fill(isim->energy()) ;
201  }
202  else if (esid.zside() < 0 ) {
203  nESHits1zm++ ;
204  ESet1zm_ += isim->energy();
205  if (meESEnergyHits1zm_) meESEnergyHits1zm_->Fill(isim->energy()) ;
206  }
207  }
208  else if (esid.plane() == 2 ) {
209  if (esid.zside() > 0 ) {
210  nESHits2zp++ ;
211  ESet2zp_ += isim->energy();
212  if (meESEnergyHits2zp_) meESEnergyHits2zp_->Fill(isim->energy()) ;
213  }
214  else if (esid.zside() < 0 ) {
215  nESHits2zm++ ;
216  ESet2zm_ += isim->energy();
217  if (meESEnergyHits2zm_) meESEnergyHits2zm_->Fill(isim->energy()) ;
218  }
219  }
220 
221  }
222 
223  if (menESHits1zp_) menESHits1zp_->Fill(nESHits1zp);
224  if (menESHits1zm_) menESHits1zm_->Fill(nESHits1zm);
225 
226  if (menESHits2zp_) menESHits2zp_->Fill(nESHits2zp);
227  if (menESHits2zm_) menESHits2zm_->Fill(nESHits2zm);
228 
229  if( meEShitLog10EnergyNorm_ && ESEnergy_ != 0 ) {
230  for( int i=0; i<140; i++ ) {
231  meEShitLog10EnergyNorm_->Fill( -10.+(float(i)+0.5)/10., econtr[i]/ESEnergy_ );
232  }
233  }
234 
235 
236  for ( HepMC::GenEvent::particle_const_iterator p = MCEvt->GetEvent()->particles_begin();
237  p != MCEvt->GetEvent()->particles_end(); ++p ) {
238 
239  double htheta = (*p)->momentum().theta();
240  double heta = -99999.;
241  if( tan(htheta * 0.5) > 0 ) {
242  heta = -log(tan(htheta * 0.5));
243  }
244 
245  if ( heta > 1.653 && heta < 2.6 ) {
246 
247  if (meE1alphaE2zp_) meE1alphaE2zp_->Fill(ESet1zp_+0.7*ESet2zp_);
248  if (meEEoverESzp_) meEEoverESzp_ ->Fill((ESet1zp_+0.7*ESet2zp_)/0.00009, EEetzp_);
249  if ((me2eszpOver1eszp_) && (ESet1zp_ != 0.)) me2eszpOver1eszp_->Fill(ESet2zp_/ESet1zp_);
250  }
251  if ( heta < -1.653 && heta > -2.6 ) {
252  if (meE1alphaE2zm_) meE1alphaE2zm_->Fill(ESet1zm_+0.7*ESet2zm_);
253  if (meEEoverESzm_) meEEoverESzm_ ->Fill((ESet1zm_+0.7*ESet2zm_)/0.00009, EEetzm_);
254  if ((me2eszmOver1eszm_) && (ESet1zm_ != 0.)) me2eszmOver1eszm_->Fill(ESet2zm_/ESet1zm_);
255  }
256  }
257 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
EventNumber_t event() const
Definition: EventID.h:44
int i
Definition: DBlmapReader.cc:9
void Fill(long long x)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::EventID id() const
Definition: EventBase.h:56
void EcalPreshowerSimHitsValidation::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file EcalPreshowerSimHitsValidation.cc.

122  {
123 
124 }
void EcalPreshowerSimHitsValidation::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 126 of file EcalPreshowerSimHitsValidation.cc.

126  {
127 
128 }

Member Data Documentation

DQMStore* EcalPreshowerSimHitsValidation::dbe_
private

Definition at line 69 of file EcalPreshowerSimHitsValidation.h.

Referenced by EcalPreshowerSimHitsValidation().

std::string EcalPreshowerSimHitsValidation::EEHitsCollection
private

Definition at line 64 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze().

std::string EcalPreshowerSimHitsValidation::ESHitsCollection
private

Definition at line 65 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze().

std::string EcalPreshowerSimHitsValidation::g4InfoLabel
private

Definition at line 63 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze().

std::string EcalPreshowerSimHitsValidation::HepMCLabel
private

Definition at line 62 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze().

MonitorElement* EcalPreshowerSimHitsValidation::me2eszmOver1eszm_
private

Definition at line 95 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::me2eszpOver1eszp_
private

Definition at line 94 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meE1alphaE2zm_
private

Definition at line 89 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meE1alphaE2zp_
private

Definition at line 88 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meEEoverESzm_
private

Definition at line 92 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meEEoverESzp_
private

Definition at line 91 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits1zm_
private

Definition at line 85 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits1zp_
private

Definition at line 82 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits2zm_
private

Definition at line 86 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits2zp_
private

Definition at line 83 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meEShitLog10Energy_
private

Definition at line 79 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::meEShitLog10EnergyNorm_
private

Definition at line 80 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::menESHits1zm_
private

Definition at line 76 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::menESHits1zp_
private

Definition at line 73 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::menESHits2zm_
private

Definition at line 77 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

MonitorElement* EcalPreshowerSimHitsValidation::menESHits2zp_
private

Definition at line 74 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

std::string EcalPreshowerSimHitsValidation::outputFile_
private

Definition at line 71 of file EcalPreshowerSimHitsValidation.h.

bool EcalPreshowerSimHitsValidation::verbose_
private

Definition at line 67 of file EcalPreshowerSimHitsValidation.h.

Referenced by EcalPreshowerSimHitsValidation().