CMS 3D CMS Logo

EvtPlaneProducer Class Reference

Description: <one line="" class="" summary>="">. More...

#include <RecoHI/EvtPlaneProducer/src/EvtPlaneProducer.cc>

Inheritance diagram for EvtPlaneProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 EvtPlaneProducer (const edm::ParameterSet &)
 ~EvtPlaneProducer ()

Private Member Functions

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

Private Attributes

bool useECAL_
bool useHCAL_


Detailed Description

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Definition at line 56 of file EvtPlaneProducer.cc.


Constructor & Destructor Documentation

EvtPlaneProducer::EvtPlaneProducer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 85 of file EvtPlaneProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), useECAL_, and useHCAL_.

00086 {
00087    //register your products
00088   
00089   useECAL_ = iConfig.getUntrackedParameter<bool>("useECAL",true);
00090   useHCAL_ = iConfig.getUntrackedParameter<bool>("useHCAL",true);
00091 
00092   produces<reco::EvtPlane>("caloLevel");
00093 
00094 }

EvtPlaneProducer::~EvtPlaneProducer (  ) 

Definition at line 97 of file EvtPlaneProducer.cc.

00098 {
00099   
00100   // do anything here that needs to be done at desctruction time
00101   // (e.g. close files, deallocate resources etc.)
00102 
00103 }


Member Function Documentation

void EvtPlaneProducer::beginJob ( const edm::EventSetup  )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 264 of file EvtPlaneProducer.cc.

00265 {
00266 }

void EvtPlaneProducer::endJob ( void   )  [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 270 of file EvtPlaneProducer.cc.

00270                          {
00271 }

void EvtPlaneProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 112 of file EvtPlaneProducer.cc.

References funct::cos(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::Event::getByLabel(), j, edm::es::l(), pi, edm::Event::put(), HcalSimpleRecAlgoImpl::reco(), s1, s2, funct::sin(), useECAL_, and useHCAL_.

00113 {
00114   using namespace edm;
00115   using namespace reco;
00116   using namespace HepMC;
00117 
00118       double ugol[9], ugol2[9];
00119       double tower_eta, tower_phi, tower_energy, tower_energy_e, tower_energy_h;
00120       double s1t, s2t, s1e, s2e, s1h, s2h;
00121       double s1[9], s2[9], TEnergy[144], TPhi[144];
00122       double pi = 3.14159;
00123       int numb; 
00124 
00125       double planeA     =  0.;
00126 
00127 //       cout << endl << "  Start of the event plane determination." << endl;
00128 
00129        for(int j=0;j<9;j++) {
00130         s1[j]  = 0.;
00131         s2[j]  = 0.;
00132        }
00133       
00134        for(int l=0;l<144;l++) {
00135         TEnergy[l]  = 0.;
00136         TPhi[l]  = 0.;
00137        }
00138 
00139       Handle<CaloTowerCollection> calotower;
00140       iEvent.getByLabel("towerMaker",calotower);
00141       
00142       if(!calotower.isValid()){
00143         cout << "Error! Can't get calotower product!" << endl;
00144        return ;
00145       }
00146 
00147         for (CaloTowerCollection::const_iterator j = calotower->begin();j !=calotower->end(); j++) {
00148 
00149 //        cout << *j << std::endl;
00150 //        cout << "ENERGY HAD " << j->hadEnergy()<< " ENERGY EM " <<j->emEnergy() 
00151 //        << " ETA " <<j->eta() << " PHI " <<j->phi() << std::endl;
00152              
00153         tower_eta        = j->eta();
00154         tower_phi        = j->phi();
00155         tower_energy_e   = j->emEnergy();
00156         tower_energy_h   = j->hadEnergy();
00157         tower_energy     = tower_energy_e + tower_energy_h;
00158         
00159         s1t = tower_energy*sin(2.*tower_phi-pi);
00160         s2t = tower_energy*cos(2.*tower_phi-pi);
00161         s1e = tower_energy_e*sin(2.*tower_phi-pi);
00162         s2e = tower_energy_e*cos(2.*tower_phi-pi);
00163         s1h = tower_energy_h*sin(2.*tower_phi-pi);
00164         s2h = tower_energy_h*cos(2.*tower_phi-pi);
00165 
00166          if (fabs(tower_eta)<3.){
00167 
00168           numb = static_cast< int >(72.*(tower_phi/pi + 1.) - 0.5);
00169           TEnergy[numb] += tower_energy;
00170           TPhi[numb]     = tower_phi;
00171 
00172 // barrel + endcap
00173           s1[0] +=  s1t;
00174           s2[0] +=  s2t;
00175           s1[3] +=  s1h;
00176           s2[3] +=  s2h;
00177           s1[6] +=  s1e;
00178           s2[6] +=  s2e;
00179           
00180 // endcap
00181          if (fabs(tower_eta)>1.5) {
00182           s1[2] +=  s1t;
00183           s2[2] +=  s2t;
00184           s1[5] +=  s1h;
00185           s2[5] +=  s2h;
00186           s1[8] +=  s1e;
00187           s2[8] +=  s2e;
00188          }
00189          }
00190          
00191 // barrel
00192          if (fabs(tower_eta)<1.5){
00193           s1[1] +=  s1t;
00194           s2[1] +=  s2t;
00195           s1[4] +=  s1h;
00196           s2[4] +=  s2h;
00197           s1[7] +=  s1e;
00198           s2[7] +=  s2e;
00199          }
00200         }
00201         
00202       for(int j1=0;j1<9;j1++) {
00203  
00204        if (s2[j1]==0.) {ugol[j1]=0.;}
00205        else {ugol[j1] = 0.5*atan(s1[j1]/s2[j1]);}
00206        
00207        if ( s2[j1] < 0 && s1[j1] <  0) ugol[j1] = ugol[j1] - pi/2.;
00208        if ( s2[j1] < 0 && s1[j1] >= 0) ugol[j1] = ugol[j1] + pi/2.;
00209        
00210        ugol2[j1] = ugol[j1] + pi/2.;
00211        if (ugol2[j1]>pi/2.) ugol2[j1] = ugol2[j1] - pi;
00212        
00213       }
00214 
00215 /*       
00216        cout <<  endl << "   Azimuthal angle of reaction plane (with minimum)" << endl
00217        << "HCAL+ECAL (b+e)   " << ugol[0] << endl
00218        << "HCAL+ECAL (b)     " << ugol[1] << endl
00219        << "HCAL+ECAL (e)     " << ugol[2] << endl
00220        << "HCAL      (b+e)   " << ugol[3] << endl
00221        << "HCAL      (b)     " << ugol[4] << endl
00222        << "HCAL      (e)     " << ugol[5] << endl
00223        << "ECAL      (b+e)   " << ugol[6] << endl
00224        << "ECAL      (b)     " << ugol[7] << endl
00225        << "ECAL      (e)     " << ugol[8] << endl;
00226 
00227        cout <<  endl << "   Azimuthal angle of reaction plane (with maximum)" << endl
00228        << "HCAL+ECAL (b+e)   " << ugol2[0] << endl
00229        << "HCAL+ECAL (b)     " << ugol2[1] << endl
00230        << "HCAL+ECAL (e)     " << ugol2[2] << endl
00231        << "HCAL      (b+e)   " << ugol2[3] << endl
00232        << "HCAL      (b)     " << ugol2[4] << endl
00233        << "HCAL      (e)     " << ugol2[5] << endl
00234        << "ECAL      (b+e)   " << ugol2[6] << endl
00235        << "ECAL      (b)     " << ugol2[7] << endl
00236        << "ECAL      (e)     " << ugol2[8] << endl  << endl;
00237 
00238 */
00239 
00240    if(useECAL_ && !useHCAL_){
00241      planeA=ugol2[6];
00242      std::auto_ptr<EvtPlane> evtplaneOutput(new EvtPlane(planeA));
00243      iEvent.put(evtplaneOutput, "caloLevel");   
00244    }
00245 
00246    if(useHCAL_ && !useECAL_){
00247      planeA=ugol2[3];
00248      std::auto_ptr<EvtPlane> evtplaneOutput(new EvtPlane(planeA));
00249      iEvent.put(evtplaneOutput, "caloLevel");   
00250    }   
00251 
00252    if(useECAL_ && useHCAL_){
00253      planeA=ugol2[0];
00254      std::auto_ptr<EvtPlane> evtplaneOutput(new EvtPlane(planeA));
00255      iEvent.put(evtplaneOutput,"caloLevel");   
00256    }    
00257 
00258 // cout << "  "<< planeA << endl;
00259  
00260 }


Member Data Documentation

bool EvtPlaneProducer::useECAL_ [private]

Definition at line 68 of file EvtPlaneProducer.cc.

Referenced by EvtPlaneProducer(), and produce().

bool EvtPlaneProducer::useHCAL_ [private]

Definition at line 69 of file EvtPlaneProducer.cc.

Referenced by EvtPlaneProducer(), and produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:20:32 2009 for CMSSW by  doxygen 1.5.4