CMS 3D CMS Logo

Classes | Public Member Functions | Static Public Member Functions | Private Attributes

dEdxAnalyzer Class Reference

#include <dEdxAnalyzer.h>

Inheritance diagram for dEdxAnalyzer:
edm::EDAnalyzer

List of all members.

Classes

struct  dEdxMEs

Public Member Functions

virtual void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual void beginJob ()
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 dEdxAnalyzer (const edm::ParameterSet &)
virtual void endJob ()
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
double mass (double P, double I)
 ~dEdxAnalyzer ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Attributes

std::vector< std::string > AlgoNames
edm::ParameterSet conf_
double dEdxC
double dEdxK
std::vector< dEdxMEsdEdxMEsVector
bool doAllPlots_
bool doDeDxPlots_
DQMStoredqmStore_
edm::ParameterSet fullconf_
GenericTriggerEventFlaggenTriggerEventFlag_
double HIPdEdxMin
std::string histname
double TrackHitMin
std::string TrackName

Detailed Description

Monitoring source for general quantities related to track dEdx.

Definition at line 27 of file dEdxAnalyzer.h.


Constructor & Destructor Documentation

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

Definition at line 28 of file dEdxAnalyzer.cc.

  : dqmStore_( edm::Service<DQMStore>().operator->() )
  , fullconf_( iConfig )
  , conf_    (fullconf_.getParameter<edm::ParameterSet>("dEdxParameters") )
  , doAllPlots_  ( conf_.getParameter<bool>("doAllPlots") )
  , doDeDxPlots_ ( conf_.getParameter<bool>("doDeDxPlots") )    
  , genTriggerEventFlag_( new GenericTriggerEventFlag(conf_) )
{
}
dEdxAnalyzer::~dEdxAnalyzer ( )

Definition at line 38 of file dEdxAnalyzer.cc.

References genTriggerEventFlag_.


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 145 of file dEdxAnalyzer.cc.

References GenericTriggerEventFlag::accept(), AlgoNames, dEdxMEsVector, doAllPlots_, doDeDxPlots_, genTriggerEventFlag_, edm::Event::getByLabel(), reco::TrackBase::highPurity, HIPdEdxMin, i, edm::HandleBase::isValid(), mass(), GenericTriggerEventFlag::on(), edm::Handle< T >::product(), lumiQTWidget::t, TrackHitMin, and TrackName.

{

  // Filter out events if Trigger Filtering is requested
  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;


   if ( doDeDxPlots_ || doAllPlots_ ){
      edm::Handle<reco::TrackCollection> trackCollectionHandle;
      iEvent.getByLabel(TrackName,trackCollectionHandle);
      if(!trackCollectionHandle.isValid())return;


      for(unsigned int i=0;i<AlgoNames.size();i++){
         edm::Handle<reco::DeDxDataValueMap> dEdxObjectHandle;
         iEvent.getByLabel(AlgoNames[i],dEdxObjectHandle);
         if(!dEdxObjectHandle.isValid())continue;
         const edm::ValueMap<reco::DeDxData> dEdxColl = *dEdxObjectHandle.product();
 
              
         for(unsigned int t=0; t<trackCollectionHandle->size(); t++){
            reco::TrackRef track = reco::TrackRef( trackCollectionHandle, t );


            if(track->quality(reco::TrackBase::highPurity) ) {
              //MIPs  
              if( track->pt() >= 5.0 && track->numberOfValidHits()>TrackHitMin){
                 dEdxMEsVector[i].ME_MipDeDx        ->Fill(dEdxColl[track].dEdx());
                 dEdxMEsVector[i].ME_MipDeDxNHits   ->Fill(dEdxColl[track].numberOfMeasurements());
                 if (dEdxColl[track].numberOfMeasurements()!=0)
                   dEdxMEsVector[i].ME_MipDeDxNSatHits->Fill((1.0*dEdxColl[track].numberOfSaturatedMeasurements())/dEdxColl[track].numberOfMeasurements());
                 dEdxMEsVector[i].ME_MipDeDxMass    ->Fill(mass(track->p(), dEdxColl[track].dEdx()));

              //HighlyIonizing particles
              }else if(track->pt()<2 && dEdxColl[track].dEdx()>HIPdEdxMin){
                 dEdxMEsVector[i].ME_HipDeDxMass    ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
              }
            }
         }
      }
   }
}
void dEdxAnalyzer::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file dEdxAnalyzer.cc.

References AlgoNames, DQMStore::book1D(), conf_, dEdxC, dEdxK, dEdxMEsVector, doAllPlots_, doDeDxPlots_, dqmStore_, edm::ParameterSet::getParameter(), HIPdEdxMin, histname, i, DQMStore::setCurrentFolder(), TrackHitMin, and TrackName.

{
    // parameters from the configuration
    AlgoNames                  = conf_.getParameter<std::vector<std::string> >("deDxProducers");
    TrackName                  = conf_.getParameter<std::string>("TracksForDeDx");
    std::string MEFolderName   = conf_.getParameter<std::string>("FolderName"); 

    // get binning from the configuration
    TrackHitMin  = conf_.getParameter<double>("TrackHitMin");
    HIPdEdxMin   = conf_.getParameter<double>("HIPdEdxMin");

    dEdxK      = conf_.getParameter<double>("dEdxK");
    dEdxC      = conf_.getParameter<double>("dEdxC");


    int    dEdxNHitBin     = conf_.getParameter<int>(   "dEdxNHitBin");
    double dEdxNHitMin     = conf_.getParameter<double>("dEdxNHitMin");
    double dEdxNHitMax     = conf_.getParameter<double>("dEdxNHitMax");

    int    dEdxBin      = conf_.getParameter<int>(   "dEdxBin");
    double dEdxMin      = conf_.getParameter<double>("dEdxMin");
    double dEdxMax      = conf_.getParameter<double>("dEdxMax");

    int    dEdxHIPmassBin  = conf_.getParameter<int>(   "dEdxHIPmassBin");
    double dEdxHIPmassMin  = conf_.getParameter<double>("dEdxHIPmassMin"); 
    double dEdxHIPmassMax  = conf_.getParameter<double>("dEdxHIPmassMax");

    int    dEdxMIPmassBin  = conf_.getParameter<int>(   "dEdxMIPmassBin");
    double dEdxMIPmassMin  = conf_.getParameter<double>("dEdxMIPmassMin"); 
    double dEdxMIPmassMax  = conf_.getParameter<double>("dEdxMIPmassMax");

    dqmStore_->setCurrentFolder(MEFolderName);

    // book the Hit Property histograms
    // ---------------------------------------------------------------------------------//

    if ( doDeDxPlots_ || doAllPlots_ ){
      for(unsigned int i=0;i<AlgoNames.size();i++){
         dqmStore_->setCurrentFolder(MEFolderName+"/"+ AlgoNames[i]);
         dEdxMEsVector.push_back(dEdxMEs() );

         histname = "MIP_dEdxPerTrack_"; 
         dEdxMEsVector[i].ME_MipDeDx = dqmStore_->book1D(histname, histname, dEdxBin, dEdxMin, dEdxMax);
         dEdxMEsVector[i].ME_MipDeDx->setAxisTitle("dEdx of each MIP Track (MeV/cm)");
         dEdxMEsVector[i].ME_MipDeDx->setAxisTitle("Number of Tracks", 2);

         histname =  "MIP_NumberOfdEdxHitsPerTrack_";
         dEdxMEsVector[i].ME_MipDeDxNHits = dqmStore_->book1D(histname, histname, dEdxNHitBin, dEdxNHitMin, dEdxNHitMax);
         dEdxMEsVector[i].ME_MipDeDxNHits->setAxisTitle("Number of dEdxHits of each MIP Track");
         dEdxMEsVector[i].ME_MipDeDxNHits->setAxisTitle("Number of Tracks", 2);

         histname =  "MIP_FractionOfSaturateddEdxHitsPerTrack_"; 
         dEdxMEsVector[i].ME_MipDeDxNSatHits = dqmStore_->book1D(histname, histname,2*dEdxNHitBin, 0, 1);
         dEdxMEsVector[i].ME_MipDeDxNSatHits->setAxisTitle("Fraction of Saturated dEdxHits of each MIP Track");
         dEdxMEsVector[i].ME_MipDeDxNSatHits->setAxisTitle("Number of Tracks", 2);

         histname =  "MIP_MassPerTrack_";
         dEdxMEsVector[i].ME_MipDeDxMass = dqmStore_->book1D(histname, histname, dEdxMIPmassBin, dEdxMIPmassMin, dEdxMIPmassMax);
         dEdxMEsVector[i].ME_MipDeDxMass->setAxisTitle("dEdx Mass of each MIP Track (GeV/c^{2})");
         dEdxMEsVector[i].ME_MipDeDxMass->setAxisTitle("Number of Tracks", 2);

         histname =  "HIP_MassPerTrack_";
         dEdxMEsVector[i].ME_HipDeDxMass = dqmStore_->book1D(histname, histname, dEdxHIPmassBin, dEdxHIPmassMin, dEdxHIPmassMax);
         dEdxMEsVector[i].ME_HipDeDxMass->setAxisTitle("dEdx Mass of each HIP Track (GeV/c^{2})");
         dEdxMEsVector[i].ME_HipDeDxMass->setAxisTitle("Number of Tracks", 2);

       }
    }
}
void dEdxAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file dEdxAnalyzer.cc.

{
}
void dEdxAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file dEdxAnalyzer.cc.

References genTriggerEventFlag_, GenericTriggerEventFlag::initRun(), and GenericTriggerEventFlag::on().

{
 
  // Initialize the GenericTriggerEventFlag
  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
}
void dEdxAnalyzer::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file dEdxAnalyzer.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::outputFileName, DQMStore::save(), and DQMStore::showDirStructure().

{
    bool outputMEsInRootFile   = conf_.getParameter<bool>("OutputMEsInRootFile");
    std::string outputFileName = conf_.getParameter<std::string>("OutputFileName");
    if(outputMEsInRootFile)
    {
        dqmStore_->showDirStructure();
        dqmStore_->save(outputFileName);
    }
}
void dEdxAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 197 of file dEdxAnalyzer.cc.

{
}
void dEdxAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 203 of file dEdxAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

                                                                         {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}
double dEdxAnalyzer::mass ( double  P,
double  I 
)

Definition at line 138 of file dEdxAnalyzer.cc.

References dEdxC, dEdxK, P, and mathSSE::sqrt().

Referenced by analyze().

                                           {
   if(I-dEdxC<0)return -1;
   return sqrt((I-dEdxC)/dEdxK)*P;
}

Member Data Documentation

std::vector< std::string > dEdxAnalyzer::AlgoNames [private]

Definition at line 74 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 48 of file dEdxAnalyzer.h.

Referenced by beginJob(), and endJob().

double dEdxAnalyzer::dEdxC [private]

Definition at line 71 of file dEdxAnalyzer.h.

Referenced by beginJob(), and mass().

double dEdxAnalyzer::dEdxK [private]

Definition at line 71 of file dEdxAnalyzer.h.

Referenced by beginJob(), and mass().

std::vector< dEdxMEs > dEdxAnalyzer::dEdxMEsVector [private]

Definition at line 75 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

bool dEdxAnalyzer::doAllPlots_ [private]

Definition at line 50 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 51 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

Definition at line 46 of file dEdxAnalyzer.h.

Referenced by beginJob(), and endJob().

Definition at line 47 of file dEdxAnalyzer.h.

Definition at line 78 of file dEdxAnalyzer.h.

Referenced by analyze(), beginRun(), and ~dEdxAnalyzer().

double dEdxAnalyzer::HIPdEdxMin [private]

Definition at line 70 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string dEdxAnalyzer::histname [private]

Definition at line 76 of file dEdxAnalyzer.h.

Referenced by beginJob().

double dEdxAnalyzer::TrackHitMin [private]

Definition at line 70 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string dEdxAnalyzer::TrackName [private]

Definition at line 73 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().