CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ElectronCalibration Class Reference

#include <Calibration/EcalCalibAlgos/src/ElectronCalibration.cc>

Inheritance diagram for ElectronCalibration:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Private Member Functions

EBDetId findMaxHit (edm::Handle< EBRecHitCollection > &)
EBDetId findMaxHit2 (const std::vector< DetId > &, const EBRecHitCollection *)

Private Attributes

std::string calibAlgo_
CalibrationCluster calibCluster
int calibClusterSize
TH1F * calibinter
TH1F * calibinterNoCuts
TH1F * calibs
TH1F * calibsNoCuts
int ClusterSize_
double cut1_
double cut2_
double cut3_
double cutCalo1_
double cutCalo2_
double cutEPCalo1_
double cutEPCalo2_
double cutEPin1_
double cutEPin2_
double cutESeed_
TH1F * DiffCalibs
TH1F * DiffCalibsNoCuts
TH1F * e25
TH1F * e25NoCuts
TH1F * E25oP
TH1F * E25oPNoCuts
TH1F * e25OverScE
TH1F * e25OverScENoCuts
TH1F * e9
TH1F * e9NoCuts
TH1F * e9Overe25
TH1F * e9Overe25NoCuts
int elecclass_
edm::InputTag electronLabel_
double ElePt_
std::vector< float > EnergyVector
std::vector< float > EnergyVectorNoCuts
TH1F * EoP
TH1F * EoP_all
TH1F * EoPNoCuts
TH1F * Error1
TH1F * Error1NoCuts
TH1F * Error2
TH1F * Error2NoCuts
TH1F * Error3
TH1F * Error3NoCuts
TH1F * eSeedOverPout
TH1F * eSeedOverPout2
TH1F * eSeedOverPout2ESeed
TH1F * eSeedOverPout2NoCuts
TH1F * eSeedOverPoutNoCuts
int etaMax
int etaMin
int eventcrystal [171][360]
std::vector< std::vector< float > > EventMatrix
std::vector< std::vector< float > > EventMatrixNoCuts
TFile * f
TH2F * GeneralMap
TH1F * hadOverEm
TH1F * hadOverEmESeed
TH1F * hadOverEmNoCuts
int keventweight
int keventweight_
TH2F * Map
TH2F * Map3Dcalib
TH2F * Map3DcalibNoCuts
TH2F * MapCor1
TH2F * MapCor10
TH2F * MapCor10ESeed
TH2F * MapCor10NoCuts
TH2F * MapCor11
TH2F * MapCor11ESeed
TH2F * MapCor11NoCuts
TH2F * MapCor1ESeed
TH2F * MapCor1NoCuts
TH2F * MapCor2
TH2F * MapCor2ESeed
TH2F * MapCor2NoCuts
TH2F * MapCor3
TH2F * MapCor3ESeed
TH2F * MapCor3NoCuts
TH2F * MapCor4
TH2F * MapCor4ESeed
TH2F * MapCor4NoCuts
TH2F * MapCor5
TH2F * MapCor5ESeed
TH2F * MapCor5NoCuts
TH2F * MapCor6
TH2F * MapCor6ESeed
TH2F * MapCor6NoCuts
TH2F * MapCor7
TH2F * MapCor7ESeed
TH2F * MapCor7NoCuts
TH2F * MapCor8
TH2F * MapCor8ESeed
TH2F * MapCor8NoCuts
TH2F * MapCor9
TH2F * MapCor9ESeed
TH2F * MapCor9NoCuts
TH2F * MapCorCalib
TH2F * MapCorCalibNoCuts
TH2F * MapNoCuts
std::vector< int > MaxCCeta
std::vector< int > MaxCCetaNoCuts
std::vector< int > MaxCCphi
std::vector< int > MaxCCphiNoCuts
int maxeta_
int maxphi_
int mineta_
int minphi_
std::string miscalibfile_
TH1F * MisCalibs
HouseholderDecompositionMyHH
MinL3AlgorithmMyL3Algo1
std::vector< float > newCalibs
int numevent_
std::vector< float > oldCalibs
int phiMax
int phiMin
TH1F * PinMinPout
TH1F * PinMinPoutNoCuts
TH1F * PinOverPout
TH1F * PinOverPoutNoCuts
TH1F * RatioCalibs
TH1F * RatioCalibsNoCuts
int read_events
edm::InputTag recHitLabel_
CalibrationCluster::CalibMap ReducedMap
std::string rootfile_
TH1F * scE
TH1F * scENoCuts
std::vector< float > solution
std::vector< float > solutionNoCuts
edm::InputTag trackLabel_
TH1F * trP
TH1F * trPNoCuts
std::vector< float > WeightVector
std::vector< float > WeightVectorNoCuts

Detailed Description

Description: Perform single electron calibration (tested on TB data only).

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

Definition at line 48 of file ElectronCalibration.h.


Constructor & Destructor Documentation

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

Definition at line 34 of file ElectronCalibration.cc.

References calibAlgo_, ClusterSize_, gather_cfg::cout, cut1_, cut2_, cut3_, cutCalo1_, cutCalo2_, cutEPCalo1_, cutEPCalo2_, cutEPin1_, cutEPin2_, cutESeed_, elecclass_, electronLabel_, ElePt_, edm::ParameterSet::getParameter(), keventweight_, maxeta_, maxphi_, mineta_, minphi_, miscalibfile_, numevent_, recHitLabel_, rootfile_, and trackLabel_.

{

   rootfile_ = iConfig.getParameter<std::string>("rootfile");
   recHitLabel_ = iConfig.getParameter< edm::InputTag > ("ebRecHitsLabel");
   electronLabel_ = iConfig.getParameter< edm::InputTag > ("electronLabel");
   trackLabel_ = iConfig.getParameter< edm::InputTag > ("trackLabel");
   calibAlgo_       = iConfig.getParameter<std::string>("CALIBRATION_ALGO");
   std::cout << " The used Algorithm is  " << calibAlgo_ << std::endl;
   keventweight_ = iConfig.getParameter<int>("keventweight");
   ClusterSize_ = iConfig.getParameter<int>("Clustersize");
   ElePt_ = iConfig.getParameter<double>("ElePt");
   maxeta_ = iConfig.getParameter<int>("maxeta");
   mineta_ = iConfig.getParameter<int>("mineta");
   maxphi_ = iConfig.getParameter<int>("maxphi");
   minphi_ = iConfig.getParameter<int>("minphi");
   cut1_ = iConfig.getParameter<double>("cut1");
   cut2_ = iConfig.getParameter<double>("cut2");
   cut3_ = iConfig.getParameter<double>("cut3");
   elecclass_ = iConfig.getParameter<int>("elecclass");
   std::cout << " The electronclass is " << elecclass_ <<std::endl;
   numevent_ = iConfig.getParameter<int>("numevent");
   miscalibfile_ = iConfig.getParameter<std::string>("miscalibfile");

   cutEPCalo1_ = iConfig.getParameter<double>("cutEPCaloMin");
   cutEPCalo2_ = iConfig.getParameter<double>("cutEPCaloMax");
   cutEPin1_ = iConfig.getParameter<double>("cutEPinMin");
   cutEPin2_ = iConfig.getParameter<double>("cutEPinMax");
   cutCalo1_ = iConfig.getParameter<double>("cutCaloMin");
   cutCalo2_ = iConfig.getParameter<double>("cutCaloMax");

   cutESeed_ = iConfig.getParameter<double>("cutESeed");
}
ElectronCalibration::~ElectronCalibration ( )

Definition at line 69 of file ElectronCalibration.cc.

{
  
  
}

Member Function Documentation

void ElectronCalibration::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 407 of file ElectronCalibration.cc.

References calibCluster, dtNoiseDBValidation_cfg::cerr, ClusterSize_, gather_cfg::cout, cut1_, cut2_, cut3_, cutEPin1_, cutEPin2_, cutESeed_, e25, e25NoCuts, E25oP, E25oPNoCuts, e25OverScE, e25OverScENoCuts, e9, e9NoCuts, e9Overe25, e9Overe25NoCuts, elecclass_, electronLabel_, ElePt_, relval_parameters_module::energy, EnergyVector, EnergyVectorNoCuts, EoP, EoP_all, EoPNoCuts, Error1, Error1NoCuts, Error2, Error2NoCuts, Error3, Error3NoCuts, eSeedOverPout, eSeedOverPout2, eSeedOverPout2ESeed, eSeedOverPout2NoCuts, eSeedOverPoutNoCuts, eventcrystal, EventMatrix, EventMatrixNoCuts, HcalObjRepresent::Fill(), findMaxHit2(), newFWLiteAna::found, GeneralMap, CalibrationCluster::get5x5Id(), edm::Event::getByLabel(), hadOverEm, hadOverEmESeed, hadOverEmNoCuts, edm::detail::isnan(), Map, MapCor1, MapCor10, MapCor10ESeed, MapCor10NoCuts, MapCor11, MapCor11ESeed, MapCor11NoCuts, MapCor1ESeed, MapCor1NoCuts, MapCor2, MapCor2ESeed, MapCor2NoCuts, MapCor3, MapCor3ESeed, MapCor3NoCuts, MapCor4, MapCor4ESeed, MapCor4NoCuts, MapCor5, MapCor5ESeed, MapCor5NoCuts, MapCor6, MapCor6ESeed, MapCor6NoCuts, MapCor7, MapCor7ESeed, MapCor7NoCuts, MapCor8, MapCor8ESeed, MapCor8NoCuts, MapCor9, MapCor9ESeed, MapCor9NoCuts, MapNoCuts, MaxCCeta, MaxCCetaNoCuts, MaxCCphi, MaxCCphiNoCuts, maxeta_, maxphi_, mineta_, minphi_, numevent_, PinMinPout, PinMinPoutNoCuts, PinOverPout, PinOverPoutNoCuts, funct::pow(), read_events, recHitLabel_, scE, scENoCuts, mathSSE::sqrt(), trP, trPNoCuts, WeightVector, and WeightVectorNoCuts.

                                                                                    {
//=================================================================================
   using namespace edm;
   
   // Get EBRecHits
   Handle<EBRecHitCollection> phits;
   iEvent.getByLabel( recHitLabel_, phits);
   if (!phits.isValid()) {
     std::cerr << "Error! can't get the product EBRecHitCollection: " << std::endl;
   }

   const EBRecHitCollection* hits = phits.product(); // get a ptr to the product

   // Get pixelElectrons
   Handle<reco::GsfElectronCollection> pElectrons;

   iEvent.getByLabel(electronLabel_, pElectrons);
   if (!pElectrons.isValid()) {
     std::cerr << "Error! can't get the product ElectronCollection: " << std::endl;
   }

  const reco::GsfElectronCollection* electronCollection = pElectrons.product();
  read_events++;
  if(read_events%1000 ==0)std::cout << "read_events = " << read_events << std::endl;
  
  if(!hits)return;
  if(hits->size() == 0)return;
  if(!electronCollection)return;
  if(electronCollection->size() == 0)return;
  
  
  //                          START HERE....
  reco::GsfElectronCollection::const_iterator eleIt = electronCollection->begin();

  reco::GsfElectron highPtElectron;

  float highestElePt=0.;
  bool found=false;
  for (eleIt=electronCollection->begin(); eleIt!=electronCollection->end(); eleIt++) {
    //Comments
    if(fabs(eleIt->eta())>(maxeta_+3) * 0.0175) continue;
    if(eleIt->eta()<(mineta_-3) * 0.0175) continue;

     if(eleIt->pt()>highestElePt) {
       highestElePt=eleIt->pt();
       highPtElectron = *eleIt;
       found =true;
     }

  }
  if(highestElePt<ElePt_)return;
      if(!found) return;
      const reco::SuperCluster & sc = *(highPtElectron.superCluster()) ;
      if(fabs(sc.eta())>(maxeta_+3) * 0.0175){
        std::cout<<"++++ Problem with electron, electron eta is "<< highPtElectron.eta()<<" while SC is "<<sc.eta()<<std::endl;return;
      }
//      std::cout << "track eta = " << highPtElectron.eta() << std::endl;
//      std::cout << "track phi = " << highPtElectron.phi() << std::endl;
    
      std::vector<DetId> v1;
      //Loop to fill the vector of DetIds
for (std::vector<std::pair<DetId,float> >::const_iterator idsIt = sc.hitsAndFractions().begin();
       idsIt != sc.hitsAndFractions().end ();++idsIt)
  {v1.push_back(idsIt->first);
 }

      //getHitsByDetId(); //Change function name
      EBDetId maxHitId;
      
      maxHitId = findMaxHit2(v1,hits); 
      
      if(maxHitId.null()){std::cout<<" Null "<<std::endl; return;}
      
      int maxCC_Eta = maxHitId.ieta();
      int maxCC_Phi = maxHitId.iphi();
      
      if(maxCC_Eta>maxeta_ )return;
      if(maxCC_Eta<mineta_ )return;
      if(maxCC_Phi>maxphi_ ) return;
      if(maxCC_Phi<minphi_ )  return;

      // number of events per crystal is set
      if(numevent_>0){
        eventcrystal[maxCC_Eta+85][maxCC_Phi-1]+=1;
        if (eventcrystal[maxCC_Eta+85][maxCC_Phi-1] > numevent_) return;
      }
      
      std::vector<EBDetId> Xtals5x5 = calibCluster.get5x5Id(maxHitId);
      
      if((int)Xtals5x5.size()!=ClusterSize_*ClusterSize_)return;
 
      // fill cluster energy
      std::vector<float> energy;
      float energy3x3=0.;  
      float energy5x5=0.;  
      
      for (int icry=0;icry<ClusterSize_*ClusterSize_;icry++){
        
           EBRecHitCollection::const_iterator itrechit;
           if(Xtals5x5[icry].subdetId()!=1) continue;
           itrechit = hits->find(Xtals5x5[icry]);
           if(itrechit==hits->end())
             { std::cout << "DetId not is e25" << std::endl;
               continue;
             }
           
           if (std::isnan(itrechit->energy())) return;    
           energy.push_back(itrechit->energy());
           energy5x5 += energy[icry];
           
           if ( icry == 6  || icry == 7  || icry == 8 ||
                icry == 11 || icry == 12 || icry ==13 ||
                icry == 16 || icry == 17 || icry ==18   )
             {
               energy3x3+=energy[icry];
             }
           
      }
      if((int)energy.size()!=ClusterSize_*ClusterSize_) return;
      //Once we have the matrix 5x5, we have to correct for gaps/cracks/umbrella and maincontainement  
      
      GeneralMap->Fill(maxCC_Eta,maxCC_Phi);
      
      EoP_all->Fill(highPtElectron.eSuperClusterOverP()); 
      
      if(highPtElectron.classification()==elecclass_ || elecclass_== -1 ){
        
        float Ptrack_in=sqrt( pow(highPtElectron.trackMomentumAtVtx().X(),2) +pow(highPtElectron.trackMomentumAtVtx().Y(),2) + pow(highPtElectron.trackMomentumAtVtx().Z(),2) );
        
        float UncorrectedPatCalo = sqrt(pow(highPtElectron.trackMomentumAtCalo().X(),2)+pow(highPtElectron.trackMomentumAtCalo().Y(),2)+pow(highPtElectron.trackMomentumAtCalo().Z(),2));
        
        float Ptrack_out = sqrt( pow(highPtElectron.trackMomentumOut().X(),2)+ pow(highPtElectron.trackMomentumOut().Y(),2)+ pow(highPtElectron.trackMomentumOut().Z(),2) );
        
        
        EventMatrixNoCuts.push_back(energy);
        EnergyVectorNoCuts.push_back(UncorrectedPatCalo);
        
        MaxCCetaNoCuts.push_back(maxCC_Eta);
        MaxCCphiNoCuts.push_back(maxCC_Phi);
        
        WeightVectorNoCuts.push_back(energy5x5/UncorrectedPatCalo);
        
        //---------------------------------------------------No Cuts-------------------------------------------------------
        e9NoCuts->Fill(energy3x3); 
        e25NoCuts->Fill(energy5x5); 
        e9Overe25NoCuts->Fill(energy3x3/energy5x5);
        scENoCuts->Fill(sc.energy()); 
        
        trPNoCuts->Fill(UncorrectedPatCalo); 
        
        EoPNoCuts->Fill(highPtElectron.eSuperClusterOverP()); 
        e25OverScENoCuts->Fill(energy5x5/sc.energy());
        
        E25oPNoCuts->Fill(energy5x5/UncorrectedPatCalo);
        
        MapNoCuts->Fill(maxCC_Eta,maxCC_Phi);
        PinOverPoutNoCuts->Fill( sqrt( pow(highPtElectron.trackMomentumAtVtx().X(),2) +pow(highPtElectron.trackMomentumAtVtx().Y(),2) + pow(highPtElectron.trackMomentumAtVtx().Z(),2) )/sqrt( pow(highPtElectron.trackMomentumOut().X(),2)+ pow(highPtElectron.trackMomentumOut().Y(),2)+ pow(highPtElectron.trackMomentumOut().Z(),2) ) );
        eSeedOverPoutNoCuts->Fill(highPtElectron.eSuperClusterOverP());
        
        MapCor1NoCuts->Fill(energy5x5/UncorrectedPatCalo,energy5x5/Ptrack_in);
        MapCor2NoCuts->Fill(energy5x5/UncorrectedPatCalo,highPtElectron.eSuperClusterOverP());
        MapCor3NoCuts->Fill(energy5x5/UncorrectedPatCalo,Ptrack_out/Ptrack_in);
        MapCor4NoCuts->Fill(energy5x5/UncorrectedPatCalo,energy5x5/highPtElectron.p());
        MapCor5NoCuts->Fill(energy5x5/UncorrectedPatCalo,UncorrectedPatCalo/Ptrack_out);
        MapCor6NoCuts->Fill(Ptrack_out/Ptrack_in,energy5x5/Ptrack_in);
        MapCor7NoCuts->Fill(Ptrack_out/Ptrack_in,UncorrectedPatCalo/Ptrack_out);
        MapCor8NoCuts->Fill(energy5x5/Ptrack_in,UncorrectedPatCalo/Ptrack_out);
        MapCor9NoCuts->Fill(energy5x5/UncorrectedPatCalo,highPtElectron.eSeedClusterOverPout());
        MapCor10NoCuts->Fill(highPtElectron.eSeedClusterOverPout(),Ptrack_out/Ptrack_in);
        MapCor11NoCuts->Fill(highPtElectron.eSeedClusterOverPout(),energy5x5/Ptrack_in);
        
        PinMinPoutNoCuts->Fill((Ptrack_in-Ptrack_out)/Ptrack_in);
        
        Error1NoCuts-> Fill(highPtElectron.trackMomentumError()/Ptrack_in);
        Error2NoCuts->Fill(highPtElectron.trackMomentumError()/Ptrack_out);
        Error3NoCuts->Fill(highPtElectron.trackMomentumError()/UncorrectedPatCalo);
        eSeedOverPout2NoCuts->Fill(highPtElectron.eSeedClusterOverPout());
        
        hadOverEmNoCuts->Fill(highPtElectron.hadronicOverEm());
        
        //------------------------------------------------Cuts-----------------------------------------------------
        //Cuts!
        if((energy3x3/energy5x5)<cut1_)return;
        
        if((Ptrack_out/Ptrack_in)< cut2_  || (Ptrack_out/Ptrack_in)> cut3_ )return;
        if((energy5x5/Ptrack_in)< cutEPin1_  || (energy5x5/Ptrack_in)> cutEPin2_ )return;
        
        e9->Fill(energy3x3); 
        e25->Fill(energy5x5); 
        e9Overe25->Fill(energy3x3/energy5x5);
        scE->Fill(sc.energy()); 
        trP->Fill(UncorrectedPatCalo);
        
        EoP->Fill(highPtElectron.eSuperClusterOverP()); 
        e25OverScE->Fill(energy5x5/sc.energy());
        
        E25oP->Fill(energy5x5/UncorrectedPatCalo);
        
        Map->Fill(maxCC_Eta,maxCC_Phi);
        PinOverPout->Fill( sqrt( pow(highPtElectron.trackMomentumAtVtx().X(),2) +pow(highPtElectron.trackMomentumAtVtx().Y(),2) + pow(highPtElectron.trackMomentumAtVtx().Z(),2) )/sqrt( pow(highPtElectron.trackMomentumOut().X(),2)+ pow(highPtElectron.trackMomentumOut().Y(),2)+ pow(highPtElectron.trackMomentumOut().Z(),2) ) );
        eSeedOverPout->Fill(highPtElectron.eSuperClusterOverP());
        
        MapCor1->Fill(energy5x5/UncorrectedPatCalo,energy5x5/Ptrack_in);
        MapCor2->Fill(energy5x5/UncorrectedPatCalo,highPtElectron.eSuperClusterOverP());
        MapCor3->Fill(energy5x5/UncorrectedPatCalo,Ptrack_out/Ptrack_in);
        MapCor4->Fill(energy5x5/UncorrectedPatCalo,energy5x5/highPtElectron.p());
        MapCor5->Fill(energy5x5/UncorrectedPatCalo,UncorrectedPatCalo/Ptrack_out);
        MapCor6->Fill(Ptrack_out/Ptrack_in,energy5x5/Ptrack_in);
        MapCor7->Fill(Ptrack_out/Ptrack_in,UncorrectedPatCalo/Ptrack_out);
        MapCor8->Fill(energy5x5/Ptrack_in,UncorrectedPatCalo/Ptrack_out);
        MapCor9->Fill(energy5x5/UncorrectedPatCalo,highPtElectron.eSeedClusterOverPout());
        MapCor10->Fill(highPtElectron.eSeedClusterOverPout(),Ptrack_out/Ptrack_in);
        MapCor11->Fill(highPtElectron.eSeedClusterOverPout(),energy5x5/Ptrack_in);
        
        PinMinPout->Fill((Ptrack_in-Ptrack_out)/Ptrack_in);
        
        Error1-> Fill(highPtElectron.trackMomentumError()/Ptrack_in);
        Error2->Fill(highPtElectron.trackMomentumError()/Ptrack_out);
        Error3->Fill(highPtElectron.trackMomentumError()/UncorrectedPatCalo);
        
        eSeedOverPout2->Fill(highPtElectron.eSeedClusterOverPout());
        hadOverEm->Fill(highPtElectron.hadronicOverEm());
        
        EventMatrix.push_back(energy);
        EnergyVector.push_back(UncorrectedPatCalo);
        MaxCCeta.push_back(maxCC_Eta);
        MaxCCphi.push_back(maxCC_Phi);
        
        WeightVector.push_back(energy5x5/UncorrectedPatCalo);
        
        //-------------------------------------------------------Extra Cut-----------------------------------------------------
        if(highPtElectron.eSeedClusterOverPout()< cutESeed_ ) return;

        MapCor1ESeed->Fill(energy5x5/UncorrectedPatCalo,energy5x5/Ptrack_in);
        MapCor2ESeed->Fill(energy5x5/UncorrectedPatCalo,highPtElectron.eSuperClusterOverP());
        MapCor3ESeed->Fill(energy5x5/UncorrectedPatCalo,Ptrack_out/Ptrack_in);
        MapCor4ESeed->Fill(energy5x5/UncorrectedPatCalo,energy5x5/highPtElectron.p());
        MapCor5ESeed->Fill(energy5x5/UncorrectedPatCalo,UncorrectedPatCalo/Ptrack_out);
        MapCor6ESeed->Fill(Ptrack_out/Ptrack_in,energy5x5/Ptrack_in);
        MapCor7ESeed->Fill(Ptrack_out/Ptrack_in,UncorrectedPatCalo/Ptrack_out);
        MapCor8ESeed->Fill(energy5x5/Ptrack_in,UncorrectedPatCalo/Ptrack_out);
        MapCor9ESeed->Fill(energy5x5/UncorrectedPatCalo,highPtElectron.eSeedClusterOverPout());
        MapCor10ESeed->Fill(highPtElectron.eSeedClusterOverPout(),Ptrack_out/Ptrack_in);
        MapCor11ESeed->Fill(highPtElectron.eSeedClusterOverPout(),energy5x5/Ptrack_in);
        
        eSeedOverPout2ESeed->Fill(highPtElectron.eSeedClusterOverPout());
        
        hadOverEmESeed->Fill(highPtElectron.hadronicOverEm());
        
      }else{return;}
}
void ElectronCalibration::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 76 of file ElectronCalibration.cc.

References calibAlgo_, calibCluster, calibClusterSize, calibinter, calibinterNoCuts, calibs, calibsNoCuts, ClusterSize_, gather_cfg::cout, DiffCalibs, DiffCalibsNoCuts, e25, e25NoCuts, E25oP, E25oPNoCuts, e25OverScE, e25OverScENoCuts, e9, e9NoCuts, e9Overe25, e9Overe25NoCuts, elecclass_, EoP, EoP_all, EoPNoCuts, Error1, Error1NoCuts, Error2, Error2NoCuts, Error3, Error3NoCuts, eSeedOverPout, eSeedOverPout2, eSeedOverPout2ESeed, eSeedOverPout2NoCuts, eSeedOverPoutNoCuts, eta(), etaMax, etaMin, eventcrystal, f, GeneralMap, CalibrationCluster::getMap(), hadOverEm, hadOverEmESeed, hadOverEmNoCuts, keventweight_, Map, Map3Dcalib, Map3DcalibNoCuts, MapCor1, MapCor10, MapCor10ESeed, MapCor10NoCuts, MapCor11, MapCor11ESeed, MapCor11NoCuts, MapCor1ESeed, MapCor1NoCuts, MapCor2, MapCor2ESeed, MapCor2NoCuts, MapCor3, MapCor3ESeed, MapCor3NoCuts, MapCor4, MapCor4ESeed, MapCor4NoCuts, MapCor5, MapCor5ESeed, MapCor5NoCuts, MapCor6, MapCor6ESeed, MapCor6NoCuts, MapCor7, MapCor7ESeed, MapCor7NoCuts, MapCor8, MapCor8ESeed, MapCor8NoCuts, MapCor9, MapCor9ESeed, MapCor9NoCuts, MapCorCalib, MapCorCalibNoCuts, MapNoCuts, maxeta_, maxphi_, mineta_, minphi_, MisCalibs, MyHH, MyL3Algo1, oldCalibs, phi, phiMax, phiMin, PinMinPout, PinMinPoutNoCuts, PinOverPout, PinOverPoutNoCuts, RatioCalibs, RatioCalibsNoCuts, read_events, ReducedMap, rootfile_, scE, scENoCuts, trP, and trPNoCuts.

                                   {
  //========================================================================
   f = new TFile(rootfile_.c_str(),"RECREATE");

  // Book histograms 
   e9 = new TH1F("e9","E9 energy", 300, 0., 150.);
  e25 = new TH1F("e25","E25 energy", 300, 0., 150.);
  scE = new TH1F("scE","SC energy", 300, 0., 150.);
  trP = new TH1F("trP","Trk momentum", 300, 0., 150.);
  EoP = new TH1F("EoP","EoP", 600, 0., 3.);
  EoP_all = new TH1F("EoP_all","EoP_all",600, 0., 3.);

  if (elecclass_ ==0 || elecclass_ == -1) { 
    calibs = new TH1F("calib","Calibration constants", 4000, 0.5, 2.);
  }else{
    calibs = new TH1F("calib","Calibration constants", 800, 0.5, 2.);
  }

  e25OverScE = new TH1F("e25OverscE","E25 / SC energy", 400, 0., 2.);
  E25oP = new TH1F("E25oP","E25 / P", 1200, 0., 1.5);

  Map = new TH2F("Map","Nb Events in Crystal",85,1, 85,70 ,5, 75);
  e9Overe25 = new TH1F("e9Overe25","E9 / E25", 400, 0., 2.);
  Map3Dcalib = new TH2F("3Dcalib", "3Dcalib",85 ,1 ,85,70, 5, 75 );

  MapCor1 = new TH2F ("MapCor1", "Correlation E25/Pcalo versus E25/Pin",100 ,0. ,5. ,100,0.,5. );
  MapCor2 = new TH2F ("MapCor2", "Correlation E25/Pcalo versus E/P",100 ,0. ,5. ,100,0.,5. );
  MapCor3 = new TH2F ("MapCor3", "Correlation E25/Pcalo versus Pout/Pin",100 ,0. ,5. ,100,0.,5. );
  MapCor4 = new TH2F ("MapCor4", "Correlation E25/Pcalo versus E25/highestP",100 ,0. ,5. ,100,0.,5. );
  MapCor5 = new TH2F ("MapCor5", "Correlation E25/Pcalo versus Pcalo/Pout",100 ,0. ,5. ,100,0.,5. );
  MapCor6 = new TH2F ("MapCor6", "Correlation Pout/Pin versus E25/Pin",100 ,0. ,5. ,100,0.,5. );
  MapCor7 = new TH2F ("MapCor7", "Correlation Pout/Pin versus Pcalo/Pout",100 ,0. ,5. ,100,0.,5. );
  MapCor8 = new TH2F ("MapCor8", "Correlation E25/Pin versus Pcalo/Pout",100 ,0. ,5. ,100,0.,5. );
  MapCor9 = new TH2F ("MapCor9", "Correlation  E25/Pcalo versus Eseed/Pout",100 ,0. ,5. ,100,0.,5. );
  MapCor10 = new TH2F ("MapCor10", "Correlation Eseed/Pout versus Pout/Pin",100 ,0. ,5. ,100,0.,5. );
  MapCor11 = new TH2F ("MapCor11", "Correlation Eseed/Pout versus E25/Pin",100 ,0. ,5. ,100,0.,5. );
  MapCorCalib = new TH2F ("MapCorCalib", "Correlation Miscalibration versus Calibration constants", 100, 0.5,1.5, 100, 0.5, 1.5);

  PinMinPout = new TH1F("PinMinPout","(Pin - Pout)/Pin",600,-2.0,2.0);

  if(elecclass_ == 0 || elecclass_ == -1) { 
    calibinter = new TH1F("calibinter", "internal calibration constants", 2000 , 0.5,2.);
    PinOverPout= new TH1F("PinOverPout", "pinOverpout", 600,0., 3.);
    eSeedOverPout= new TH1F("eSeedOverPout", "eSeedOverpout ", 600, 0., 3.);
    MisCalibs = new TH1F("MisCalibs","Miscalibration constants",4000,0.5,2.);
    RatioCalibs = new TH1F("RatioCalibs","Ratio in Calibration Constants", 4000, 0.5, 2.0);
    DiffCalibs = new TH1F("DiffCalibs", "Difference in Calibration constants", 4000, -1.0,1.0);
  }else { 
    calibinter = new TH1F("calibinter", "internal calibration constants",400 , 0.5,2.);
    PinOverPout= new TH1F("PinOverPout", "pinOverpout", 600,0., 3.);
    eSeedOverPout= new TH1F("eSeedOverPout", "eSeedOverpout ", 600, 0., 3.);
    MisCalibs = new TH1F("MisCalibs","Miscalibration constants",800,0.5,2.);
    RatioCalibs = new TH1F("RatioCalibs","Ratio in Calibration Constants", 800, 0.5, 2.0);
    DiffCalibs = new TH1F("DiffCalibs", "Difference in Calibration constants", 800, -1.0,1.0);
  }
  Error1 = new TH1F ("Error1","DeltaP/Pin",800 ,-1.0,1.0 );
  Error2 = new TH1F ("Error2","DeltaP/Pout",800 ,-1.0,1.0 );
  Error3 = new TH1F ("Error3","DeltaP/Pcalo",800 ,-1.0,1.0 );
  eSeedOverPout2= new TH1F("eSeedOverPout2", "eSeedOverpout (No Supercluster)", 600, 0., 4.);
  hadOverEm= new TH1F("hadOverEm", "Had/EM distribution", 600, -2., 2.);
  
  // Book histograms  
  Map3DcalibNoCuts = new TH2F("3DcalibNoCuts", "3Dcalib (Before Cuts)",85 ,1 ,85,70, 5, 75 );
  e9NoCuts = new TH1F("e9NoCuts","E9 energy (Before Cuts)",300, 0., 150.);
  e25NoCuts = new TH1F("e25NoCuts","E25 energy (Before Cuts)", 300, 0., 150.);
  scENoCuts = new TH1F("scENoCuts","SC energy (Before Cuts)", 300, 0., 150.);
  trPNoCuts = new TH1F("trPNoCuts","Trk momentum (Before Cuts)", 300, 0., 150.);
  EoPNoCuts = new TH1F("EoPNoCuts","EoP (Before Cuts)", 600, 0., 3.);
  if (elecclass_ ==0 || elecclass_ == -1){ 
    calibsNoCuts = new TH1F("calibNoCuts","Calibration constants (Before Cuts)", 4000, 0., 2.);
  }else{
    calibsNoCuts = new TH1F("calibNoCuts","Calibration constants (Before Cuts)", 800, 0., 2.);
  }
  e25OverScENoCuts = new TH1F("e25OverscENoCuts","E25 / SC energy (Before Cuts)", 400, 0., 2.);
  E25oPNoCuts = new TH1F("E25oPNoCuts","E25 / P (Before Cuts)", 1200, 0., 1.5);
  MapNoCuts = new TH2F("MapNoCuts","Nb Events in Crystal (Before Cuts)",85,1, 85,70 ,5, 75);
  e9Overe25NoCuts = new TH1F("e9Overe25NoCuts","E9 / E25 (Before Cuts)", 400, 0., 2.);
  PinOverPoutNoCuts = new TH1F("PinOverPoutNoCuts", "pinOverpout (Before Cuts)", 600,0., 3.);
  eSeedOverPoutNoCuts = new TH1F(" eSeedOverPoutNoCuts", "eSeedOverpout (Before Cuts) ", 600, 0., 4.);
  PinMinPoutNoCuts = new TH1F("PinMinPoutNoCuts","(Pin - Pout)/Pin (Before Cuts)",600,-2.0,2.0);

  RatioCalibsNoCuts = new TH1F("RatioCalibsNoCuts","Ratio in Calibration Constants (Before Cuts)", 4000, 0.5, 2.0);
  DiffCalibsNoCuts = new TH1F("DiffCalibsNoCuts", "Difference in Calibration constants (Before Cuts)", 4000, -1.0,1.0);
  calibinterNoCuts = new TH1F("calibinterNoCuts", "internal calibration constants", 2000 , 0.5,2.);
 
  MapCor1NoCuts = new TH2F ("MapCor1NoCuts", "Correlation E25/PatCalo versus E25/Pin (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor2NoCuts = new TH2F ("MapCor2NoCuts", "Correlation E25/PatCalo versus E/P (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor3NoCuts = new TH2F ("MapCor3NoCuts", "Correlation E25/PatCalo versus Pout/Pin (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor4NoCuts = new TH2F ("MapCor4NoCuts", "Correlation E25/PatCalo versus E25/highestP (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor5NoCuts = new TH2F ("MapCor5NoCuts", "Correlation E25/Pcalo versus Pcalo/Pout (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor6NoCuts = new TH2F ("MapCor6NoCuts", "Correlation Pout/Pin versus E25/Pin (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor7NoCuts = new TH2F ("MapCor7NoCuts", "Correlation Pout/Pin versus Pcalo/Pout (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor8NoCuts = new TH2F ("MapCor8NoCuts", "Correlation E25/Pin versus Pcalo/Pout (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor9NoCuts = new TH2F ("MapCor9NoCuts", "Correlation  E25/Pcalo versus Eseed/Pout (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor10NoCuts = new TH2F ("MapCor10NoCuts", "Correlation Eseed/Pout versus Pout/Pin (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCor11NoCuts = new TH2F ("MapCor11NoCuts", "Correlation Eseed/Pout versus E25/Pin (Before Cuts)",100 ,0. ,5. ,100,0.,5. );
  MapCorCalibNoCuts = new TH2F ("MapCorCalibNoCuts", "Correlation Miscalibration versus Calibration constants (Before Cuts)", 100, 0., 3., 100, 0., 3.);

  Error1NoCuts = new TH1F ("Eror1NoCuts","DeltaP/Pin (Before Cuts)",800 ,-1.0,1.0 );
  Error2NoCuts = new TH1F ("Error2NoCuts","DeltaP/Pout (Before Cuts)",800 ,-1.0,1.0 );
  Error3NoCuts = new TH1F ("Error3NoCuts","DeltaP/Pcalo (Before Cuts)",800 ,-1.0, 1.0);
  eSeedOverPout2NoCuts= new TH1F("eSeedOverPout2NoCuts", "eSeedOverpout (No Supercluster, Before Cuts)", 600, 0., 4.);
  hadOverEmNoCuts= new TH1F("hadOverEmNoCuts", "Had/EM distribution (Before Cuts)", 600, -2., 2.);

  //Book histograms after ESeed cut
  MapCor1ESeed = new TH2F ("MapCor1ESeed", "Correlation E25/Pcalo versus E25/Pin (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor2ESeed = new TH2F ("MapCor2ESeed", "Correlation E25/Pcalo versus E/P (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor3ESeed = new TH2F ("MapCor3ESeed", "Correlation E25/Pcalo versus Pout/Pin (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor4ESeed = new TH2F ("MapCor4ESeed", "Correlation E25/Pcalo versus E25/highestP (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor5ESeed = new TH2F ("MapCor5ESeed", "Correlation E25/Pcalo versus Pcalo/Pout (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor6ESeed = new TH2F ("MapCor6ESeed", "Correlation Pout/Pin versus E25/Pin (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor7ESeed = new TH2F ("MapCor7ESeed", "Correlation Pout/Pin versus Pcalo/Pout (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor8ESeed = new TH2F ("MapCor8ESeed", "Correlation E25/Pin versus Pcalo/Pout (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor9ESeed = new TH2F ("MapCor9ESeed", "Correlation  E25/Pcalo versus Eseed/Pout (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor10ESeed = new TH2F ("MapCor10ESeed", "Correlation Eseed/Pout versus Pout/Pin (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
  MapCor11ESeed = new TH2F ("MapCor11ESeed", "Correlation Eseed/Pout versus E25/Pin (after Eseed/Pout cut)",100 ,0. ,5. ,100,0.,5. );
 
  eSeedOverPout2ESeed= new TH1F("eSeedOverPout2ESeed", "eSeedOverpout (No Supercluster, after Eseed/Pout cut)", 600, 0., 4.);

  hadOverEmESeed= new TH1F("hadOverEmESeed", "Had/EM distribution (after Eseed/Pout cut)", 600, -2., 2.);
 
 //Book histograms without any cut
  GeneralMap = new TH2F("GeneralMap","Map without any cuts",85,1,85,70,5,75);

  calibClusterSize=ClusterSize_; 
  etaMin = mineta_;
  etaMax = maxeta_;
  phiMin = minphi_;
  phiMax = maxphi_;
  if(calibAlgo_=="L3") {
    MyL3Algo1 = new MinL3Algorithm(keventweight_,calibClusterSize, etaMin, etaMax, phiMin, phiMax);
  }else{ 
    if(calibAlgo_=="HH" || calibAlgo_=="HHReg"){
      MyHH = new HouseholderDecomposition(calibClusterSize, etaMin,etaMax, phiMin, phiMax); 
    }else{ 
      std::cout<<" Name of Algorithm is not recognize "<<calibAlgo_<<" Should be either L3, HH or HHReg. Abort! "<<std::endl;
    }
  }
  read_events=0;
  
  // get Region to be calibrated  
  ReducedMap = calibCluster.getMap(etaMin, etaMax, phiMin, phiMax);
  
  oldCalibs.resize(ReducedMap.size(),0.);

   // table is set to zero
  for (int phi=0; phi<360; phi++){for (int eta=0; eta<171; eta++){eventcrystal[eta][phi]=0;}}
 

  std::cout<<" Begin JOB "<<std::endl;
}
void ElectronCalibration::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 232 of file ElectronCalibration.cc.

References calibAlgo_, calibinter, calibinterNoCuts, calibs, calibsNoCuts, gather_cfg::cout, DiffCalibs, DiffCalibsNoCuts, EnergyVector, EnergyVectorNoCuts, eta(), EBDetId::ETAPHIMODE, EventMatrix, EventMatrixNoCuts, f, MinL3Algorithm::iterate(), HouseholderDecomposition::iterate(), Map3Dcalib, Map3DcalibNoCuts, MapCorCalib, MapCorCalibNoCuts, MaxCCeta, MaxCCetaNoCuts, MaxCCphi, MaxCCphiNoCuts, maxeta_, maxphi_, mineta_, minphi_, miscalibfile_, MisCalibs, MyHH, MyL3Algo1, newCalibs, phi, RatioCalibs, RatioCalibsNoCuts, read_events, ReducedMap, HouseholderDecomposition::runRegional(), solution, solutionNoCuts, and calibXMLwriter::writeLine().

                            {
//========================================================================

int nIterations =10;
if(calibAlgo_=="L3"){ 
  solution = MyL3Algo1->iterate(EventMatrix, MaxCCeta, MaxCCphi, EnergyVector, nIterations);
 }else{
  if(calibAlgo_=="HH"){
    solution = MyHH->iterate(EventMatrix, MaxCCeta, MaxCCphi,EnergyVector, 1,false);
  }else{
    if(calibAlgo_=="HHReg"){solution = MyHH->runRegional(EventMatrix, MaxCCeta, MaxCCphi,EnergyVector, 2);
    }else{ 
      std::cout<<" Calibration not run due to problem in Algo Choice..."<<std::endl;return;
    }
  }
 }
 for (int ii=0;ii<(int)solution.size();ii++)
   {
     std::cout << "solution[" << ii << "] = " << solution[ii] << std::endl;
     calibs->Fill(solution[ii]); 
   }
 
 newCalibs.resize(ReducedMap.size(),0.);
 
 calibXMLwriter write_calibrations;
 
 FILE* MisCalib;
 MisCalib = fopen(miscalibfile_.c_str(),"r");
 int fileStatus=1;
 int eta=-1;
 int phi=-1;
 float coeff=-1;
 
 std::map<EBDetId,float> OldCoeff;
 
 while(fileStatus != EOF) {
   fileStatus = fscanf(MisCalib,"%d %d %f\n",  &eta,&phi,&coeff);
   if(eta!=-1&&phi!=-1&& coeff!=-1){
     //      std::cout<<" We have read correctly the coefficient " << coeff << " corresponding to eta "<<eta<<" and  phi "<<phi<<std::endl;
     OldCoeff.insert(std::make_pair(EBDetId(eta,phi,EBDetId::ETAPHIMODE),coeff )); 
   }
 } 
 
 fclose(MisCalib);
 
 int icry=0;
 CalibrationCluster::CalibMap::iterator itmap;
 for (itmap=ReducedMap.begin(); itmap != ReducedMap.end();itmap++){
   
   newCalibs[icry] = solution[icry];
   
   write_calibrations.writeLine(itmap->first,newCalibs[icry]);
   float Compare =1.;   
   std::map<EBDetId,float>::iterator iter = OldCoeff.find(itmap->first);
   if( iter != OldCoeff.end() )Compare = iter->second;

   if((itmap->first).ieta()>mineta_ && (itmap->first).ieta()<maxeta_ && (itmap->first).iphi()>minphi_ && (itmap->first).iphi()<maxphi_){
     Map3Dcalib->Fill((itmap->first).ieta(),(itmap->first).iphi(),newCalibs[icry]*Compare ) ;
     MisCalibs->Fill(Compare);

}
   if((itmap->first).ieta()< mineta_+2){icry++; continue;}
   if((itmap->first).ieta()> maxeta_-2){icry++; continue;}
   if((itmap->first).iphi()< minphi_+2){icry++; continue;} 
   if((itmap->first).iphi()> maxphi_-2){icry++; continue;}

   calibinter->Fill(newCalibs[icry]);
   DiffCalibs->Fill(newCalibs[icry]-1./Compare);
   RatioCalibs->Fill(newCalibs[icry]*Compare);
   MapCorCalib->Fill(1./Compare, newCalibs[icry]);
   icry++;
 }
 
 if(calibAlgo_=="L3"){
   solutionNoCuts = MyL3Algo1->iterate(EventMatrixNoCuts, MaxCCetaNoCuts, MaxCCphiNoCuts,EnergyVectorNoCuts,nIterations);
 }else{
   if(calibAlgo_=="HH"){
     solutionNoCuts = MyHH->iterate(EventMatrixNoCuts, MaxCCetaNoCuts, MaxCCphiNoCuts, EnergyVectorNoCuts, 1,false);
   }else{ 
     if(calibAlgo_=="HHReg"){
       solutionNoCuts = MyHH->runRegional(EventMatrixNoCuts, MaxCCetaNoCuts, MaxCCphiNoCuts,EnergyVectorNoCuts, 2);
     }else{
       std::cout<<" Calibration not run due to problem in AlgoChoice..."<<std::endl;return;
     }
   }
 }
 for (int ii=0;ii<(int)solutionNoCuts.size();ii++){
   calibsNoCuts->Fill(solutionNoCuts[ii]); 
 }
 int icryp=0;
 CalibrationCluster::CalibMap::iterator itmapp;
 for (itmapp=ReducedMap.begin(); itmapp != ReducedMap.end();itmapp++){
   
   newCalibs[icryp] = solutionNoCuts[icryp];
   float Compare2 =1.;   
   std::map<EBDetId,float>::iterator iter2 = OldCoeff.find(itmapp->first);
   if( iter2 != OldCoeff.end() )Compare2 = iter2->second;
   
   if((itmapp->first).ieta()>mineta_ && (itmapp->first).ieta()<maxeta_ && (itmapp->first).iphi()>minphi_ && (itmapp->first).iphi()<maxphi_)Map3DcalibNoCuts->Fill((itmapp->first).ieta(),(itmapp->first).iphi(),newCalibs[icryp]*Compare2) ;
   if ((itmapp->first).ieta()< mineta_+2){icryp++; continue;}
   if ((itmapp->first).ieta()> maxeta_-2){icryp++; continue;}
   if ((itmapp->first).iphi()< minphi_+2){icryp++; continue;} 
   if ((itmapp->first).iphi()> maxphi_-2){icryp++; continue;}
   calibinterNoCuts->Fill(newCalibs[icryp]);
   DiffCalibsNoCuts->Fill(newCalibs[icryp]-1./(Compare2));
   RatioCalibsNoCuts->Fill(newCalibs[icryp]*Compare2);
   MapCorCalibNoCuts->Fill(1./Compare2 ,newCalibs[icryp]);
   icryp++;
 }
 
 
 
 
 std::cout << " " << std::endl;
 std::cout << "************* STATISTICS **************" << std::endl;
 std::cout << " Events Studied "<<read_events<< std::endl;
 
   
    f->Write();
   
    f->Close();
}
EBDetId ElectronCalibration::findMaxHit ( edm::Handle< EBRecHitCollection > &  phits) [private]

Definition at line 359 of file ElectronCalibration.cc.

References edm::SortedCollection< T, SORT >::begin(), prof2calltree::count, edm::SortedCollection< T, SORT >::end(), and AlCaHLTBitMon_ParallelJobs::p.

                                                                              {
//=================================================================================

     EcalRecHitCollection ecrh = *phits;
     EcalRecHitCollection::iterator it;
     int count=0;
     EBDetId save;
     float en_save=0;
     for (it = ecrh.begin(); it != ecrh.end(); it++)
     {
       EBDetId p = EBDetId(it->id().rawId());
        if(it->energy()> en_save){
          en_save=it->energy();
          save=p;
        }
        count++;
     }
     return save;

}
EBDetId ElectronCalibration::findMaxHit2 ( const std::vector< DetId > &  v1,
const EBRecHitCollection hits 
) [private]

Definition at line 381 of file ElectronCalibration.cc.

References gather_cfg::cout, edm::SortedCollection< T, SORT >::end(), and edm::SortedCollection< T, SORT >::find().

Referenced by analyze().

                                                                                                    {
//=================================================================================

  double currEnergy = 0.;
  EBDetId maxHit;
  
  for( std::vector<DetId>::const_iterator idsIt = v1.begin(); idsIt != v1.end(); ++idsIt) {
    if(idsIt->subdetId()!=1) continue;
    EBRecHitCollection::const_iterator itrechit;
    itrechit = hits->find(*idsIt);
           
    if(itrechit == hits->end()){
      std::cout << "ElectronCalibration::findMaxHit2: rechit not found! " << std::endl;
      continue;
    }
    if(itrechit->energy() > currEnergy) {
      currEnergy=itrechit->energy();
      maxHit= *idsIt;
    }
  }
  
      return maxHit;
}

Member Data Documentation

std::string ElectronCalibration::calibAlgo_ [private]

Definition at line 66 of file ElectronCalibration.h.

Referenced by beginJob(), ElectronCalibration(), and endJob().

Definition at line 87 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 92 of file ElectronCalibration.h.

Referenced by beginJob().

Definition at line 147 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 148 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

TH1F* ElectronCalibration::calibs [private]

Definition at line 121 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 140 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 85 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), and ElectronCalibration().

double ElectronCalibration::cut1_ [private]

Definition at line 74 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

double ElectronCalibration::cut2_ [private]

Definition at line 75 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

double ElectronCalibration::cut3_ [private]

Definition at line 76 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

Definition at line 82 of file ElectronCalibration.h.

Referenced by ElectronCalibration().

Definition at line 83 of file ElectronCalibration.h.

Referenced by ElectronCalibration().

Definition at line 78 of file ElectronCalibration.h.

Referenced by ElectronCalibration().

Definition at line 79 of file ElectronCalibration.h.

Referenced by ElectronCalibration().

Definition at line 80 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

Definition at line 81 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

Definition at line 84 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

Definition at line 131 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 133 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

TH1F* ElectronCalibration::e25 [private]

Definition at line 115 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 135 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

TH1F* ElectronCalibration::E25oP [private]

Definition at line 125 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 144 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 123 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 142 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

TH1F* ElectronCalibration::e9 [private]

Definition at line 116 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 136 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 122 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 141 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 77 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), and ElectronCalibration().

Definition at line 64 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

double ElectronCalibration::ElePt_ [private]

Definition at line 69 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

std::vector<float> ElectronCalibration::EnergyVector [private]

Definition at line 94 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

std::vector<float> ElectronCalibration::EnergyVectorNoCuts [private]

Definition at line 99 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

TH1F* ElectronCalibration::EoP [private]

Definition at line 119 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 120 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 139 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

TH1F* ElectronCalibration::Error1 [private]

Definition at line 197 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 200 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

TH1F* ElectronCalibration::Error2 [private]

Definition at line 198 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 201 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

TH1F* ElectronCalibration::Error3 [private]

Definition at line 199 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 202 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 128 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 204 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 206 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 205 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 151 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 93 of file ElectronCalibration.h.

Referenced by beginJob().

Definition at line 93 of file ElectronCalibration.h.

Referenced by beginJob().

int ElectronCalibration::eventcrystal[171][360] [private]

Definition at line 110 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

std::vector<std::vector<float> > ElectronCalibration::EventMatrix [private]

Definition at line 96 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

std::vector<std::vector<float> > ElectronCalibration::EventMatrixNoCuts [private]

Definition at line 101 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

TFile* ElectronCalibration::f [private]

Definition at line 113 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 153 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 208 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 210 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 209 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 92 of file ElectronCalibration.h.

Definition at line 68 of file ElectronCalibration.h.

Referenced by beginJob(), and ElectronCalibration().

TH2F* ElectronCalibration::Map [private]

Definition at line 124 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 145 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 146 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 155 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 164 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 190 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 177 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 165 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 191 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 178 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 181 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 168 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 156 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 182 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 169 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 157 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 183 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 170 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 158 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 184 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 171 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 159 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 185 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 172 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 160 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 186 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 173 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 161 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 187 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 174 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 162 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 188 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 175 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 163 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 189 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 176 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 166 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 179 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 143 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

std::vector<int> ElectronCalibration::MaxCCeta [private]

Definition at line 97 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

std::vector<int> ElectronCalibration::MaxCCetaNoCuts [private]

Definition at line 102 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

std::vector<int> ElectronCalibration::MaxCCphi [private]

Definition at line 98 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

std::vector<int> ElectronCalibration::MaxCCphiNoCuts [private]

Definition at line 103 of file ElectronCalibration.h.

Referenced by analyze(), and endJob().

Definition at line 70 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), ElectronCalibration(), and endJob().

Definition at line 72 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), ElectronCalibration(), and endJob().

Definition at line 71 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), ElectronCalibration(), and endJob().

Definition at line 73 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), ElectronCalibration(), and endJob().

std::string ElectronCalibration::miscalibfile_ [private]

Definition at line 67 of file ElectronCalibration.h.

Referenced by ElectronCalibration(), and endJob().

Definition at line 129 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 149 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 104 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

std::vector<float> ElectronCalibration::newCalibs [private]

Definition at line 107 of file ElectronCalibration.h.

Referenced by endJob().

Definition at line 111 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

std::vector<float> ElectronCalibration::oldCalibs [private]

Definition at line 108 of file ElectronCalibration.h.

Referenced by beginJob().

Definition at line 93 of file ElectronCalibration.h.

Referenced by beginJob().

Definition at line 93 of file ElectronCalibration.h.

Referenced by beginJob().

Definition at line 194 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 195 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 127 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 150 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 130 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 132 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

Definition at line 90 of file ElectronCalibration.h.

Referenced by analyze(), beginJob(), and endJob().

Definition at line 63 of file ElectronCalibration.h.

Referenced by analyze(), and ElectronCalibration().

Definition at line 88 of file ElectronCalibration.h.

Referenced by beginJob(), and endJob().

std::string ElectronCalibration::rootfile_ [private]

Definition at line 62 of file ElectronCalibration.h.

Referenced by beginJob(), and ElectronCalibration().

TH1F* ElectronCalibration::scE [private]

Definition at line 117 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 137 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

std::vector<float> ElectronCalibration::solution [private]

Definition at line 105 of file ElectronCalibration.h.

Referenced by endJob().

std::vector<float> ElectronCalibration::solutionNoCuts [private]

Definition at line 106 of file ElectronCalibration.h.

Referenced by endJob().

Definition at line 65 of file ElectronCalibration.h.

Referenced by ElectronCalibration().

TH1F* ElectronCalibration::trP [private]

Definition at line 118 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

Definition at line 138 of file ElectronCalibration.h.

Referenced by analyze(), and beginJob().

std::vector<float> ElectronCalibration::WeightVector [private]

Definition at line 95 of file ElectronCalibration.h.

Referenced by analyze().

std::vector<float> ElectronCalibration::WeightVectorNoCuts [private]

Definition at line 100 of file ElectronCalibration.h.

Referenced by analyze().