CMS 3D CMS Logo

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

#include <Alignment/APEEstimation/src/ApeEstimator.cc>

Inheritance diagram for ApeEstimator:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  PositionAndError2
 

Public Member Functions

 ApeEstimator (const edm::ParameterSet &)
 
 ~ApeEstimator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::pair
< TrackStruct::HitState,
PositionAndError2
StatePositionAndError2
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
void bookSectorHistsForAnalyzerMode ()
 
void bookSectorHistsForApeCalculation ()
 
void bookTrackHists ()
 
void calculateAPE ()
 
bool checkIntervalsForSectors (const unsigned int sectorCounter, const std::vector< double > &) const
 
bool checkModuleBools (const bool, const std::vector< unsigned int > &) const
 
bool checkModuleDirections (const int, const std::vector< int > &) const
 
bool checkModuleIds (const unsigned int, const std::vector< unsigned int > &) const
 
bool checkModulePositions (const float, const std::vector< double > &) const
 
virtual void endJob ()
 
void fillHistsForAnalyzerMode (const TrackStruct &)
 
void fillHistsForApeCalculation (const TrackStruct &)
 
void fillHitHistsXForAnalyzerMode (const TrackStruct::HitParameterStruct &, TrackerSectorStruct &)
 
void fillHitHistsYForAnalyzerMode (const TrackStruct::HitParameterStruct &, TrackerSectorStruct &)
 
TrackStruct::HitParameterStruct fillHitVariables (const TrajectoryMeasurement &, const edm::EventSetup &)
 
TrackStruct::TrackParameterStruct fillTrackVariables (const reco::Track &, const Trajectory &, const reco::BeamSpot &)
 
bool hitSelected (TrackStruct::HitParameterStruct &) const
 
void hitSelection ()
 
bool inDoubleInterval (const std::vector< double > &, const float) const
 
bool inUintInterval (const std::vector< unsigned int > &, const unsigned int, const unsigned int=999) const
 
bool isHit2D (const TrackingRecHit &) const
 
StatePositionAndError2 positionAndError2 (const LocalPoint &, const LocalError &, const TransientTrackingRecHit &)
 
PositionAndError2 radialPositionAndError2 (const LocalPoint &, const LocalError &, const RadialStripTopology &)
 
PositionAndError2 rectangularPositionAndError2 (const LocalPoint &, const LocalError &)
 
void residualErrorBinning ()
 
void sectorBuilder ()
 
void setHitSelectionMap (const std::string &)
 
void setHitSelectionMapUInt (const std::string &)
 
void statistics (const TrackerSectorStruct &, const Int_t) const
 

Private Attributes

const bool analyzerMode_
 
const bool calculateApe_
 
unsigned int counter1
 
unsigned int counter2
 
unsigned int counter3
 
unsigned int counter4
 
unsigned int counter5
 
unsigned int counter6
 
std::map< std::string,
std::vector< double > > 
m_hitSelection_
 
std::map< std::string,
std::vector< unsigned int > > 
m_hitSelectionUInt_
 
std::map< unsigned int,
std::pair< double, double > > 
m_resErrBins_
 
std::map< unsigned int,
TrackerSectorStruct
m_tkSector_
 
std::map< unsigned int,
ReducedTrackerTreeVariables
m_tkTreeVar_
 
const unsigned int maxTracksPerEvent_
 
const unsigned int minGoodHitsPerTrack_
 
edm::EDGetTokenT< reco::BeamSpotofflinebeamSpot_
 
const edm::ParameterSet parameterSet_
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
tjTagToken_
 
TrackerDetectorStruct tkDetector_
 
bool trackCut_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

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

Definition at line 130 of file ApeEstimator.cc.

Member Typedef Documentation

Definition at line 145 of file ApeEstimator.cc.

Constructor & Destructor Documentation

ApeEstimator::ApeEstimator ( const edm::ParameterSet iConfig)
explicit

Definition at line 227 of file ApeEstimator.cc.

References counter1, counter2, counter3, counter4, counter5, and counter6.

227  :
228 parameterSet_(iConfig),
229 tjTagToken_(consumes<TrajTrackAssociationCollection>(parameterSet_.getParameter<edm::InputTag>("tjTkAssociationMapTag"))),
230 offlinebeamSpot_(consumes<reco::BeamSpot>(edm::InputTag("offlineBeamSpot"))),
231 trackCut_(false), maxTracksPerEvent_(parameterSet_.getParameter<unsigned int>("maxTracksPerEvent")),
232 minGoodHitsPerTrack_(parameterSet_.getParameter<unsigned int>("minGoodHitsPerTrack")),
233 analyzerMode_(parameterSet_.getParameter<bool>("analyzerMode")),
234 calculateApe_(parameterSet_.getParameter<bool>("calculateApe"))
235 {
237 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
const bool calculateApe_
unsigned int counter1
unsigned int counter3
unsigned int counter4
const unsigned int maxTracksPerEvent_
const bool analyzerMode_
edm::EDGetTokenT< reco::BeamSpot > offlinebeamSpot_
unsigned int counter6
unsigned int counter5
unsigned int counter2
const unsigned int minGoodHitsPerTrack_
edm::EDGetTokenT< TrajTrackAssociationCollection > tjTagToken_
ApeEstimator::~ApeEstimator ( )

Definition at line 240 of file ApeEstimator.cc.

241 {
242 }

Member Function Documentation

void ApeEstimator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 2162 of file ApeEstimator.cc.

References analyzerMode_, SiPixelRawToDigiRegional_cfi::beamSpot, calculateApe_, edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, fillHistsForAnalyzerMode(), fillHistsForApeCalculation(), fillHitVariables(), fillTrackVariables(), edm::Event::getByToken(), hitSelected(), edm::HandleBase::isValid(), maxTracksPerEvent_, offlinebeamSpot_, tjTagToken_, tkDetector_, trackCut_, TrackStruct::trkParams, TrackerDetectorStruct::TrkSize, TrackerDetectorStruct::TrkSizeGood, and TrackStruct::v_hitParams.

2163 {
2164 
2166  edm::Handle<reco::BeamSpot> beamSpotHandle;
2167  iEvent.getByToken(offlinebeamSpot_, beamSpotHandle);
2168 
2169  if (beamSpotHandle.isValid()){
2170  beamSpot = *beamSpotHandle;
2171  }
2172  else
2173  {
2174  edm::LogError("ApeEstimator")<<"No beam spot available from EventSetup"
2175  <<"\n...skip event";
2176  return;
2177  }
2178 
2180  iEvent.getByToken(tjTagToken_, m_TrajTracksMap);
2181 
2182  if(analyzerMode_)tkDetector_.TrkSize->Fill(m_TrajTracksMap->size());
2183 
2184  if(maxTracksPerEvent_!=0 && m_TrajTracksMap->size()>maxTracksPerEvent_)return;
2185 
2186  //Creation of (traj,track)
2187  typedef std::pair<const Trajectory*, const reco::Track*> ConstTrajTrackPair;
2188  typedef std::vector<ConstTrajTrackPair> ConstTrajTrackPairCollection;
2189  ConstTrajTrackPairCollection trajTracks;
2190 
2192  for(i_trajTrack = m_TrajTracksMap->begin();i_trajTrack != m_TrajTracksMap->end();++i_trajTrack){
2193  trajTracks.push_back(ConstTrajTrackPair(&(*(*i_trajTrack).key), &(*(*i_trajTrack).val)));
2194  }
2195 
2196 
2197  //Loop over Tracks & Hits
2198  unsigned int trackSizeGood(0);
2199  ConstTrajTrackPairCollection::const_iterator iTrack;
2200  for(iTrack = trajTracks.begin(); iTrack != trajTracks.end();++iTrack){
2201 
2202  const Trajectory *traj = (*iTrack).first;
2203  const reco::Track *track = (*iTrack).second;
2204 
2205  TrackStruct trackStruct;
2206  trackStruct.trkParams = this->fillTrackVariables(*track, *traj, beamSpot);
2207 
2208  if(trackCut_)continue;
2209 
2210  const std::vector<TrajectoryMeasurement> v_meas = (*traj).measurements();
2211 
2212  //Loop over Hits
2213  for(std::vector<TrajectoryMeasurement>::const_iterator i_meas = v_meas.begin(); i_meas != v_meas.end(); ++i_meas){
2214  TrackStruct::HitParameterStruct hitParams = this->fillHitVariables(*i_meas, iSetup);
2215  if(this->hitSelected(hitParams))trackStruct.v_hitParams.push_back(hitParams);
2216  }
2217 
2218  if(analyzerMode_)this->fillHistsForAnalyzerMode(trackStruct);
2219  if(calculateApe_)this->fillHistsForApeCalculation(trackStruct);
2220 
2221  if(trackStruct.v_hitParams.size()>0)++trackSizeGood;
2222  }
2223  if(analyzerMode_ && trackSizeGood>0)tkDetector_.TrkSizeGood->Fill(trackSizeGood);
2224 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const bool calculateApe_
TrackerDetectorStruct tkDetector_
const unsigned int maxTracksPerEvent_
TrackStruct::HitParameterStruct fillHitVariables(const TrajectoryMeasurement &, const edm::EventSetup &)
const bool analyzerMode_
std::vector< HitParameterStruct > v_hitParams
TrackStruct::TrackParameterStruct fillTrackVariables(const reco::Track &, const Trajectory &, const reco::BeamSpot &)
TrackParameterStruct trkParams
edm::EDGetTokenT< reco::BeamSpot > offlinebeamSpot_
bool hitSelected(TrackStruct::HitParameterStruct &) const
bool isValid() const
Definition: HandleBase.h:75
std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
void fillHistsForApeCalculation(const TrackStruct &)
edm::EDGetTokenT< TrajTrackAssociationCollection > tjTagToken_
void fillHistsForAnalyzerMode(const TrackStruct &)
void ApeEstimator::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 2229 of file ApeEstimator.cc.

References analyzerMode_, bookSectorHistsForAnalyzerMode(), bookSectorHistsForApeCalculation(), bookTrackHists(), calculateApe_, hitSelection(), residualErrorBinning(), and sectorBuilder().

2229  {
2230 
2231  this->hitSelection();
2232 
2233  this->sectorBuilder();
2234 
2235  this->residualErrorBinning();
2236 
2238 
2240 
2241  if(analyzerMode_)this->bookTrackHists();
2242 
2243 
2244 }
void hitSelection()
void bookSectorHistsForAnalyzerMode()
const bool calculateApe_
void sectorBuilder()
void residualErrorBinning()
const bool analyzerMode_
void bookTrackHists()
void bookSectorHistsForApeCalculation()
void ApeEstimator::bookSectorHistsForAnalyzerMode ( )
private

Definition at line 560 of file ApeEstimator.cc.

References edm::errors::Configuration, objects.IsoTrackAnalyzer::dzMax, Exception, fileService, edm::ParameterSet::getParameter(), m_tkSector_, TFileDirectory::make(), TFileService::mkdir(), and parameterSet_.

Referenced by beginJob().

560  {
561 
562  std::vector<unsigned int> v_errHists(parameterSet_.getParameter<std::vector<unsigned int> >("vErrHists"));
563  for(std::vector<unsigned int>::iterator i_errHists = v_errHists.begin(); i_errHists != v_errHists.end(); ++i_errHists){
564  for(std::vector<unsigned int>::iterator i_errHists2 = i_errHists; i_errHists2 != v_errHists.end();){
565  ++i_errHists2;
566  if(*i_errHists==*i_errHists2){
567  edm::LogError("BookSectorHists")<<"Value of vErrHists in config exists twice: "<<*i_errHists<<"\n... delete one of both";
568  v_errHists.erase(i_errHists2);
569  }
570  }
571  }
572 
573 
574  for(std::map<unsigned int,TrackerSectorStruct>::iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
575  bool zoomHists(parameterSet_.getParameter<bool>("zoomHists"));
576 
577  double widthMax = zoomHists ? 20. : 200.;
578  double chargePixelMax = zoomHists ? 200000. : 2000000.;
579  double chargeStripMax = zoomHists ? 1000. : 10000.;
580  double sOverNMax = zoomHists ? 200. : 2000.;
581  double logClusterProbMin = zoomHists ? -5. : -15.;
582 
583  double resXAbsMax = zoomHists ? 0.5 : 5.;
584  double norResXAbsMax = zoomHists ? 10. : 50.;
585  double probXMin = zoomHists ? -0.01 : -0.1;
586  double probXMax = zoomHists ? 0.11 : 1.1;
587  double sigmaXMin = zoomHists ? 0. : -0.05;
588  double sigmaXMax = zoomHists ? 0.02 : 1.;
589  double sigmaX2Max = sigmaXMax*sigmaXMax;
590  double sigmaXHitMax = zoomHists ? 0.02 : 1.;
591  double phiSensXMax = zoomHists ? 31. : 93.;
592 
593  double norChi2Max = zoomHists ? 5. : 1000.;
594  double d0Max = zoomHists ? 0.02 : 40.; // cosmics: 100.|100.
595  double dzMax = zoomHists ? 15. : 100.; // cosmics: 200.|600.
596  double pMax = zoomHists ? 200. : 2000.;
597  double invPMax = zoomHists ? 0.05 : 10.; //begins at 20GeV, 0.1GeV
598 
599 
601  if(!fileService){
603  "TFileService is not registered in cfg file" );
604  }
605 
606  std::stringstream sector; sector << "Sector_" << (*i_sector).first;
607  TFileDirectory secDir = fileService->mkdir(sector.str().c_str());
608 
609  // Dummy histo containing the sector name as title
610  (*i_sector).second.Name = secDir.make<TH1F>("z_name",(*i_sector).second.name.c_str(),1,0,1);
611 
612  // Do not book histos for empty sectors
613  if((*i_sector).second.v_rawId.size()==0){
614  continue;
615  }
616  // Set parameters for correlationHists
617  (*i_sector).second.setCorrHistParams(&secDir,norResXAbsMax,sigmaXHitMax,sigmaXMax);
618 
619 
620  // Book pixel or strip specific hists
621  const bool pixelSector(i_sector->second.isPixel);
622 
623 
624  // Cluster Parameters
625  (*i_sector).second.m_correlationHistsX["WidthX"] = (*i_sector).second.bookCorrHistsX("WidthX","cluster width","w_{cl,x}","[# channels]",static_cast<int>(widthMax),static_cast<int>(widthMax),0.,widthMax,"nph");
626  (*i_sector).second.m_correlationHistsX["BaryStripX"] = (*i_sector).second.bookCorrHistsX("BaryStripX","barycenter of cluster charge","b_{cl,x}","[# channels]",800,100,-10.,790.,"nph");
627 
628  if(pixelSector){
629  (*i_sector).second.m_correlationHistsY["WidthY"] = (*i_sector).second.bookCorrHistsY("WidthY","cluster width","w_{cl,y}","[# channels]",static_cast<int>(widthMax),static_cast<int>(widthMax),0.,widthMax,"nph");
630  (*i_sector).second.m_correlationHistsY["BaryStripY"] = (*i_sector).second.bookCorrHistsY("BaryStripY","barycenter of cluster charge","b_{cl,y}","[# channels]",800,100,-10.,790.,"nph");
631 
632  (*i_sector).second.m_correlationHistsX["ChargePixel"] = (*i_sector).second.bookCorrHistsX("ChargePixel","cluster charge","c_{cl}","[e]",100,50,0.,chargePixelMax,"nph");
633  (*i_sector).second.m_correlationHistsX["ClusterProbXY"] = (*i_sector).second.bookCorrHistsX("ClusterProbXY","cluster probability xy","prob_{cl,xy}","",100,50,0.,1.,"nph");
634  (*i_sector).second.m_correlationHistsX["ClusterProbQ"] = (*i_sector).second.bookCorrHistsX("ClusterProbQ","cluster probability q","prob_{cl,q}","",100,50,0.,1.,"nph");
635  (*i_sector).second.m_correlationHistsX["ClusterProbXYQ"] = (*i_sector).second.bookCorrHistsX("ClusterProbXYQ","cluster probability xyq","prob_{cl,xyq}","",100,50,0.,1.,"nph");
636  (*i_sector).second.m_correlationHistsX["LogClusterProb"] = (*i_sector).second.bookCorrHistsX("LogClusterProb","cluster probability xy","log(prob_{cl,xy})","",60,30,logClusterProbMin,0.,"nph");
637  (*i_sector).second.m_correlationHistsX["IsOnEdge"] = (*i_sector).second.bookCorrHistsX("IsOnEdge","IsOnEdge","isOnEdge","",2,2,0,2,"nph");
638  (*i_sector).second.m_correlationHistsX["HasBadPixels"] = (*i_sector).second.bookCorrHistsX("HasBadPixels","HasBadPixels","hasBadPixels","",2,2,0,2,"nph");
639  (*i_sector).second.m_correlationHistsX["SpansTwoRoc"] = (*i_sector).second.bookCorrHistsX("SpansTwoRoc","SpansTwoRoc","spansTwoRoc","",2,2,0,2,"nph");
640  (*i_sector).second.m_correlationHistsX["QBin"] = (*i_sector).second.bookCorrHistsX("QBin","q bin","q bin","",8,8,0,8,"nph");
641 
642  (*i_sector).second.m_correlationHistsY["ChargePixel"] = (*i_sector).second.bookCorrHistsY("ChargePixel","cluster charge","c_{cl}","[e]",100,50,0.,chargePixelMax,"nph");
643  (*i_sector).second.m_correlationHistsY["ClusterProbXY"] = (*i_sector).second.bookCorrHistsY("ClusterProbXY","cluster probability xy","prob_{cl,xy}","",100,50,0.,1.,"nph");
644  (*i_sector).second.m_correlationHistsY["ClusterProbQ"] = (*i_sector).second.bookCorrHistsY("ClusterProbQ","cluster probability q","prob_{cl,q}","",100,50,0.,1.,"nph");
645  (*i_sector).second.m_correlationHistsY["ClusterProbXYQ"] = (*i_sector).second.bookCorrHistsY("ClusterProbXYQ","cluster probability xyq","prob_{cl,xyq}","",100,50,0.,1.,"nph");
646  (*i_sector).second.m_correlationHistsY["LogClusterProb"] = (*i_sector).second.bookCorrHistsY("LogClusterProb","cluster probability xy","log(prob_{cl,xy})","",60,30,logClusterProbMin,0.,"nph");
647  (*i_sector).second.m_correlationHistsY["IsOnEdge"] = (*i_sector).second.bookCorrHistsY("IsOnEdge","IsOnEdge","isOnEdge","",2,2,0,2,"nph");
648  (*i_sector).second.m_correlationHistsY["HasBadPixels"] = (*i_sector).second.bookCorrHistsY("HasBadPixels","HasBadPixels","hasBadPixels","",2,2,0,2,"nph");
649  (*i_sector).second.m_correlationHistsY["SpansTwoRoc"] = (*i_sector).second.bookCorrHistsY("SpansTwoRoc","SpansTwoRoc","spansTwoRoc","",2,2,0,2,"nph");
650  (*i_sector).second.m_correlationHistsY["QBin"] = (*i_sector).second.bookCorrHistsY("QBin","q bin","q bin","",8,8,0,8,"nph");
651  }
652 
653  else{
654  (*i_sector).second.m_correlationHistsX["ChargeStrip"] = (*i_sector).second.bookCorrHistsX("ChargeStrip","cluster charge","c_{cl}","[APV counts]",100,50,0.,chargeStripMax,"nph");
655  (*i_sector).second.m_correlationHistsX["MaxStrip"] = (*i_sector).second.bookCorrHistsX("MaxStrip","strip with max. charge","n_{cl,max}","[# strips]",800,800,-10.,790.,"npht");
656  (*i_sector).second.m_correlationHistsX["MaxCharge"] = (*i_sector).second.bookCorrHistsX("MaxCharge","charge of strip with max. charge","c_{cl,max}","[APV counts]",300,75,-10.,290.,"nph");
657  (*i_sector).second.m_correlationHistsX["MaxIndex"] = (*i_sector).second.bookCorrHistsX("MaxIndex","cluster-index of strip with max. charge","i_{cl,max}","[# strips]",10,10,0.,10.,"nph");
658  (*i_sector).second.m_correlationHistsX["ChargeOnEdges"] = (*i_sector).second.bookCorrHistsX("ChargeOnEdges","fraction of charge on edge strips","(c_{st,L}+c_{st,R})/c_{cl}","",60,60,-0.1,1.1,"nph");
659  (*i_sector).second.m_correlationHistsX["ChargeAsymmetry"] = (*i_sector).second.bookCorrHistsX("ChargeAsymmetry","asymmetry of charge on edge strips","(c_{st,L}-c_{st,R})/c_{cl}","",110,55,-1.1,1.1,"nph");
660  (*i_sector).second.m_correlationHistsX["ChargeLRplus"] = (*i_sector).second.bookCorrHistsX("ChargeLRplus","fraction of charge not on maxStrip","(c_{cl,L}+c_{cl,R})/c_{cl}","",60,60,-0.1,1.1,"nph");
661  (*i_sector).second.m_correlationHistsX["ChargeLRminus"] = (*i_sector).second.bookCorrHistsX("ChargeLRminus","asymmetry of charge L and R of maxStrip","(c_{cl,L}-c_{cl,R})/c_{cl}","",110,55,-1.1,1.1,"nph");
662  (*i_sector).second.m_correlationHistsX["SOverN"] = (*i_sector).second.bookCorrHistsX("SOverN","signal over noise","s/N","",100,50,0,sOverNMax,"nph");
663  (*i_sector).second.m_correlationHistsX["WidthProj"] = (*i_sector).second.bookCorrHistsX("WidthProj","projected width","w_{p}","[# strips]",200,20,0.,widthMax,"nph");
664  (*i_sector).second.m_correlationHistsX["WidthDiff"] = (*i_sector).second.bookCorrHistsX("WidthDiff","width difference","w_{p} - w_{cl}","[# strips]",200,20,-widthMax/2.,widthMax/2.,"nph");
665 
666  (*i_sector).second.WidthVsWidthProjected = secDir.make<TH2F>("h2_widthVsWidthProj","w_{cl} vs. w_{p};w_{p} [# strips];w_{cl} [# strips]",static_cast<int>(widthMax),0,widthMax,static_cast<int>(widthMax),0,widthMax);
667  (*i_sector).second.PWidthVsWidthProjected = secDir.make<TProfile>("p_widthVsWidthProj","w_{cl} vs. w_{p};w_{p} [# strips];w_{cl} [# strips]",static_cast<int>(widthMax),0,widthMax);
668 
669  (*i_sector).second.WidthDiffVsMaxStrip = secDir.make<TH2F>("h2_widthDiffVsMaxStrip","(w_{p} - w_{cl}) vs. n_{cl,max};n_{cl,max};w_{p} - w_{cl} [# strips]",800,-10.,790.,static_cast<int>(widthMax),-widthMax/2.,widthMax/2.);
670  (*i_sector).second.PWidthDiffVsMaxStrip = secDir.make<TProfile>("p_widthDiffVsMaxStrip","(w_{p} - w_{cl}) vs. n_{cl,max};n_{cl,max};w_{p} - w_{cl} [# strips]",800,-10.,790.);
671 
672  (*i_sector).second.WidthDiffVsSigmaXHit = secDir.make<TH2F>("h2_widthDiffVsSigmaXHit","(w_{p} - w_{cl}) vs. #sigma_{hit,x};#sigma_{hit,x} [cm];w_{p} - w_{cl} [# strips]",100,0.,sigmaXMax,100,-10.,10.);
673  (*i_sector).second.PWidthDiffVsSigmaXHit = secDir.make<TProfile>("p_widthDiffVsSigmaXHit","(w_{p} - w_{cl}) vs. #sigma_{hit,x};#sigma_{hit,x} [cm];w_{p} - w_{cl} [# strips]",100,0.,sigmaXMax);
674 
675  (*i_sector).second.WidthVsPhiSensX = secDir.make<TH2F>("h2_widthVsPhiSensX","w_{cl} vs. #phi_{module,x};#phi_{module,x} [ ^{o}];w_{cl} [# strips]",93,-93,93,static_cast<int>(widthMax),0,widthMax);
676  (*i_sector).second.PWidthVsPhiSensX = secDir.make<TProfile>("p_widthVsPhiSensX","w_{cl} vs. #phi_{module,x};#phi_{module,x} [ ^{o}];w_{cl} [# strips]",93,-93,93);
677  }
678 
679 
680  // Hit Parameters (transform errors and residuals from [cm] in [mum])
681  (*i_sector).second.m_correlationHistsX["SigmaXHit"] = (*i_sector).second.bookCorrHistsX("SigmaXHit","hit error","#sigma_{hit,x}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
682  (*i_sector).second.m_correlationHistsX["SigmaXTrk"] = (*i_sector).second.bookCorrHistsX("SigmaXTrk","track error","#sigma_{trk,x}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
683  (*i_sector).second.m_correlationHistsX["SigmaX"] = (*i_sector).second.bookCorrHistsX("SigmaX","residual error","#sigma_{r,x}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
684  (*i_sector).second.m_correlationHistsX["PhiSens"] = (*i_sector).second.bookCorrHistsX("PhiSens","track angle on sensor","#phi_{module}","[ ^{o}]",96,48,-3,93,"nphtr");
685  (*i_sector).second.m_correlationHistsX["PhiSensX"] = (*i_sector).second.bookCorrHistsX("PhiSensX","track angle on sensor","#phi_{module,x}","[ ^{o}]",186,93,-phiSensXMax,phiSensXMax,"nphtr");
686  (*i_sector).second.m_correlationHistsX["PhiSensY"] = (*i_sector).second.bookCorrHistsX("PhiSensY","track angle on sensor","#phi_{module,y}","[ ^{o}]",186,93,-93,93,"nphtr");
687 
688  (*i_sector).second.XHit = secDir.make<TH1F>("h_XHit"," hit measurement x_{hit};x_{hit} [cm];# hits",100,-20,20);
689  (*i_sector).second.XTrk = secDir.make<TH1F>("h_XTrk","track prediction x_{trk};x_{trk} [cm];# hits",100,-20,20);
690  (*i_sector).second.SigmaX2 = secDir.make<TH1F>("h_SigmaX2","squared residual error #sigma_{r,x}^{2};#sigma_{r,x}^{2} [#mum^{2}];# hits",105,sigmaXMin*10000.,sigmaX2Max*10000.*10000.); //no mistake !
691  (*i_sector).second.ResX = secDir.make<TH1F>("h_ResX","residual r_{x};x_{trk}-x_{hit} [#mum];# hits",100,-resXAbsMax*10000.,resXAbsMax*10000.);
692  (*i_sector).second.NorResX = secDir.make<TH1F>("h_NorResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-norResXAbsMax,norResXAbsMax);
693  (*i_sector).second.ProbX = secDir.make<TH1F>("h_ProbX","residual probability;prob(r_{x}^{2}/#sigma_{r,x}^{2},1);# hits",60,probXMin,probXMax);
694 
695  (*i_sector).second.PhiSensXVsBarycentreX = secDir.make<TH2F>("h2_phiSensXVsBarycentreX","#phi_{module,x} vs. b_{cl,x};b_{cl,x} [# channels];#phi_{module,x} [ ^{o}]",200,-10.,790.,93,-93,93);
696  (*i_sector).second.PPhiSensXVsBarycentreX = secDir.make<TProfile>("p_phiSensXVsBarycentreX","#phi_{module,x} vs. b_{cl,x};b_{cl,x} [# channels];#phi_{module,x} [ ^{o}]",200,-10.,790.);
697 
698  if(pixelSector){
699  (*i_sector).second.m_correlationHistsY["SigmaYHit"] = (*i_sector).second.bookCorrHistsY("SigmaYHit","hit error","#sigma_{hit,y}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
700  (*i_sector).second.m_correlationHistsY["SigmaYTrk"] = (*i_sector).second.bookCorrHistsY("SigmaYTrk","track error","#sigma_{trk,y}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
701  (*i_sector).second.m_correlationHistsY["SigmaY"] = (*i_sector).second.bookCorrHistsY("SigmaY","residual error","#sigma_{r,y}","[#mum]",105,20,sigmaXMin*10000.,sigmaXMax*10000.,"np");
702  (*i_sector).second.m_correlationHistsY["PhiSens"] = (*i_sector).second.bookCorrHistsY("PhiSens","track angle on sensor","#phi_{module}","[ ^{o}]",96,48,-3,93,"nphtr");
703  (*i_sector).second.m_correlationHistsY["PhiSensX"] = (*i_sector).second.bookCorrHistsY("PhiSensX","track angle on sensor","#phi_{module,x}","[ ^{o}]",186,93,-phiSensXMax,phiSensXMax,"nphtr");
704  (*i_sector).second.m_correlationHistsY["PhiSensY"] = (*i_sector).second.bookCorrHistsY("PhiSensY","track angle on sensor","#phi_{module,y}","[ ^{o}]",186,93,-93,93,"nphtr");
705 
706  (*i_sector).second.YHit = secDir.make<TH1F>("h_YHit"," hit measurement y_{hit};y_{hit} [cm];# hits",100,-20,20);
707  (*i_sector).second.YTrk = secDir.make<TH1F>("h_YTrk","track prediction y_{trk};y_{trk} [cm];# hits",100,-20,20);
708  (*i_sector).second.SigmaY2 = secDir.make<TH1F>("h_SigmaY2","squared residual error #sigma_{r,y}^{2};#sigma_{r,y}^{2} [#mum^{2}];# hits",105,sigmaXMin*10000.,sigmaX2Max*10000.*10000.); //no mistake !
709  (*i_sector).second.ResY = secDir.make<TH1F>("h_ResY","residual r_{y};y_{trk}-y_{hit} [#mum];# hits",100,-resXAbsMax*10000.,resXAbsMax*10000.);
710  (*i_sector).second.NorResY = secDir.make<TH1F>("h_NorResY","normalized residual r_{y}/#sigma_{r,y};(y_{trk}-y_{hit})/#sigma_{r,y};# hits",100,-norResXAbsMax,norResXAbsMax);
711  (*i_sector).second.ProbY = secDir.make<TH1F>("h_ProbY","residual probability;prob(r_{y}^{2}/#sigma_{r,y}^{2},1);# hits",60,probXMin,probXMax);
712 
713  (*i_sector).second.PhiSensYVsBarycentreY = secDir.make<TH2F>("h2_phiSensYVsBarycentreY","#phi_{module,y} vs. b_{cl,y};b_{cl,y} [# channels];#phi_{module,y} [ ^{o}]",200,-10.,790.,93,-93,93);
714  (*i_sector).second.PPhiSensYVsBarycentreY = secDir.make<TProfile>("p_phiSensYVsBarycentreY","#phi_{module,y} vs. b_{cl,y};b_{cl,y} [# channels];#phi_{module,y} [ ^{o}]",200,-10.,790.);
715  }
716 
717 
718  // Track Parameters
719  (*i_sector).second.m_correlationHistsX["HitsValid"] = (*i_sector).second.bookCorrHistsX("HitsValid","# hits","[valid]",50,0,50,"npt");
720  (*i_sector).second.m_correlationHistsX["HitsInvalid"] = (*i_sector).second.bookCorrHistsX("HitsInvalid","# hits","[invalid]",20,0,20,"npt");
721  (*i_sector).second.m_correlationHistsX["Hits2D"] = (*i_sector).second.bookCorrHistsX("Hits2D","# hits","[2D]",20,0,20,"npt");
722  (*i_sector).second.m_correlationHistsX["LayersMissed"] = (*i_sector).second.bookCorrHistsX("LayersMissed","# layers","[missed]",10,0,10,"npt");
723  (*i_sector).second.m_correlationHistsX["HitsPixel"] = (*i_sector).second.bookCorrHistsX("HitsPixel","# hits","[pixel]",10,0,10,"npt");
724  (*i_sector).second.m_correlationHistsX["HitsStrip"] = (*i_sector).second.bookCorrHistsX("HitsStrip","# hits","[strip]",40,0,40,"npt");
725  (*i_sector).second.m_correlationHistsX["HitsGood"] = (*i_sector).second.bookCorrHistsX("HitsGood","# hits","[good]",50,0,50,"npt");
726  (*i_sector).second.m_correlationHistsX["NorChi2"] = (*i_sector).second.bookCorrHistsX("NorChi2","#chi^{2}/f","",50,0,norChi2Max,"npr");
727  (*i_sector).second.m_correlationHistsX["Theta"] = (*i_sector).second.bookCorrHistsX("Theta","#theta","[ ^{o}]",40,-10,190,"npt");
728  (*i_sector).second.m_correlationHistsX["Phi"] = (*i_sector).second.bookCorrHistsX("Phi","#phi","[ ^{o}]",76,-190,190,"npt");
729  (*i_sector).second.m_correlationHistsX["D0Beamspot"] = (*i_sector).second.bookCorrHistsX("D0Beamspot","d_{0, BS}","[cm]",40,-d0Max,d0Max,"npt");
730  (*i_sector).second.m_correlationHistsX["Dz"] = (*i_sector).second.bookCorrHistsX("Dz","d_{z}","[cm]",40,-dzMax,dzMax,"npt");
731  (*i_sector).second.m_correlationHistsX["Pt"] = (*i_sector).second.bookCorrHistsX("Pt","p_{t}","[GeV]",50,0,pMax,"npt");
732  (*i_sector).second.m_correlationHistsX["P"] = (*i_sector).second.bookCorrHistsX("P","|p|","[GeV]",50,0,pMax,"npt");
733  (*i_sector).second.m_correlationHistsX["InvP"] = (*i_sector).second.bookCorrHistsX("InvP","1/|p|","[GeV^{-1}]",25,0,invPMax,"t");
734  (*i_sector).second.m_correlationHistsX["MeanAngle"] = (*i_sector).second.bookCorrHistsX("MeanAngle","<#phi_{module}>","[ ^{o}]",25,-5,95,"npt");
735  //(*i_sector).second.m_correlationHistsX[""] = (*i_sector).second.bookCorrHistsX("","","",,,,"nphtr");
736 
737  if(pixelSector){
738  (*i_sector).second.m_correlationHistsY["HitsValid"] = (*i_sector).second.bookCorrHistsY("HitsValid","# hits","[valid]",50,0,50,"npt");
739  (*i_sector).second.m_correlationHistsY["HitsInvalid"] = (*i_sector).second.bookCorrHistsY("HitsInvalid","# hits","[invalid]",20,0,20,"npt");
740  (*i_sector).second.m_correlationHistsY["Hits2D"] = (*i_sector).second.bookCorrHistsY("Hits2D","# hits","[2D]",20,0,20,"npt");
741  (*i_sector).second.m_correlationHistsY["LayersMissed"] = (*i_sector).second.bookCorrHistsY("LayersMissed","# layers","[missed]",10,0,10,"npt");
742  (*i_sector).second.m_correlationHistsY["HitsPixel"] = (*i_sector).second.bookCorrHistsY("HitsPixel","# hits","[pixel]",10,0,10,"npt");
743  (*i_sector).second.m_correlationHistsY["HitsStrip"] = (*i_sector).second.bookCorrHistsY("HitsStrip","# hits","[strip]",40,0,40,"npt");
744  (*i_sector).second.m_correlationHistsY["HitsGood"] = (*i_sector).second.bookCorrHistsY("HitsGood","# hits","[good]",50,0,50,"npt");
745  (*i_sector).second.m_correlationHistsY["NorChi2"] = (*i_sector).second.bookCorrHistsY("NorChi2","#chi^{2}/f","",50,0,norChi2Max,"npr");
746  (*i_sector).second.m_correlationHistsY["Theta"] = (*i_sector).second.bookCorrHistsY("Theta","#theta","[ ^{o}]",40,-10,190,"npt");
747  (*i_sector).second.m_correlationHistsY["Phi"] = (*i_sector).second.bookCorrHistsY("Phi","#phi","[ ^{o}]",76,-190,190,"npt");
748  (*i_sector).second.m_correlationHistsY["D0Beamspot"] = (*i_sector).second.bookCorrHistsY("D0Beamspot","d_{0, BS}","[cm]",40,-d0Max,d0Max,"npt");
749  (*i_sector).second.m_correlationHistsY["Dz"] = (*i_sector).second.bookCorrHistsY("Dz","d_{z}","[cm]",40,-dzMax,dzMax,"npt");
750  (*i_sector).second.m_correlationHistsY["Pt"] = (*i_sector).second.bookCorrHistsY("Pt","p_{t}","[GeV]",50,0,pMax,"npt");
751  (*i_sector).second.m_correlationHistsY["P"] = (*i_sector).second.bookCorrHistsY("P","|p|","[GeV]",50,0,pMax,"npt");
752  (*i_sector).second.m_correlationHistsY["InvP"] = (*i_sector).second.bookCorrHistsY("InvP","1/|p|","[GeV^{-1}]",25,0,invPMax,"t");
753  (*i_sector).second.m_correlationHistsY["MeanAngle"] = (*i_sector).second.bookCorrHistsY("MeanAngle","<#phi_{module}>","[ ^{o}]",25,-5,95,"npt");
754  }
755 
756 
757  // (transform errors and residuals from [cm] in [mum])
758  for(std::vector<unsigned int>::iterator i_errHists = v_errHists.begin(); i_errHists != v_errHists.end(); ++i_errHists){
759  double xMin(0.01*(*i_errHists-1)), xMax(0.01*(*i_errHists));
760  std::stringstream sigmaXHit, sigmaXTrk, sigmaX;
761  sigmaXHit << "h_sigmaXHit_" << *i_errHists;
762  sigmaXTrk << "h_sigmaXTrk_" << *i_errHists;
763  sigmaX << "h_sigmaX_" << *i_errHists;
764  (*i_sector).second.m_sigmaX["sigmaXHit"].push_back(secDir.make<TH1F>(sigmaXHit.str().c_str(),"hit error #sigma_{hit,x};#sigma_{hit,x} [#mum];# hits",100,xMin*10000.,xMax*10000.));
765  (*i_sector).second.m_sigmaX["sigmaXTrk"].push_back(secDir.make<TH1F>(sigmaXTrk.str().c_str(),"track error #sigma_{trk,x};#sigma_{trk,x} [#mum];# hits",100,xMin*10000.,xMax*10000.));
766  (*i_sector).second.m_sigmaX["sigmaX" ].push_back(secDir.make<TH1F>(sigmaX.str().c_str(),"residual error #sigma_{r,x};#sigma_{r,x} [#mum];# hits",100,xMin*10000.,xMax*10000.));
767  if(pixelSector){
768  std::stringstream sigmaYHit, sigmaYTrk, sigmaY;
769  sigmaYHit << "h_sigmaYHit_" << *i_errHists;
770  sigmaYTrk << "h_sigmaYTrk_" << *i_errHists;
771  sigmaY << "h_sigmaY_" << *i_errHists;
772  (*i_sector).second.m_sigmaY["sigmaYHit"].push_back(secDir.make<TH1F>(sigmaYHit.str().c_str(),"hit error #sigma_{hit,y};#sigma_{hit,y} [#mum];# hits",100,xMin*10000.,xMax*10000.));
773  (*i_sector).second.m_sigmaY["sigmaYTrk"].push_back(secDir.make<TH1F>(sigmaYTrk.str().c_str(),"track error #sigma_{trk,y};#sigma_{trk,y} [#mum];# hits",100,xMin*10000.,xMax*10000.));
774  (*i_sector).second.m_sigmaY["sigmaY" ].push_back(secDir.make<TH1F>(sigmaY.str().c_str(),"residual error #sigma_{r,y};#sigma_{r,y} [#mum];# hits",100,xMin*10000.,xMax*10000.));
775  }
776  }
777 
778  }
779 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
T * make(const Args &...args) const
make new ROOT object
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::Service< TFileService > fileService
void ApeEstimator::bookSectorHistsForApeCalculation ( )
private

Definition at line 784 of file ApeEstimator.cc.

References edm::errors::Configuration, Exception, fileService, edm::ParameterSet::getParameter(), MergeJob_cfg::interval, m_resErrBins_, m_tkSector_, TFileDirectory::make(), python.multivaluedict::map(), TFileDirectory::mkdir(), TFileService::mkdir(), and parameterSet_.

Referenced by beginJob().

784  {
785 
786  std::vector<unsigned int> v_errHists(parameterSet_.getParameter<std::vector<unsigned int> >("vErrHists"));
787  for(std::vector<unsigned int>::iterator i_errHists = v_errHists.begin(); i_errHists != v_errHists.end(); ++i_errHists){
788  for(std::vector<unsigned int>::iterator i_errHists2 = i_errHists; i_errHists2 != v_errHists.end();){
789  ++i_errHists2;
790  if(*i_errHists==*i_errHists2){
791  edm::LogError("BookSectorHists")<<"Value of vErrHists in config exists twice: "<<*i_errHists<<"\n... delete one of both";
792  v_errHists.erase(i_errHists2);
793  }
794  }
795  }
796 
797  for(std::map<unsigned int,TrackerSectorStruct>::iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
798 
800  if(!fileService){
802  "TFileService is not registered in cfg file" );
803  }
804 
805  std::stringstream sector; sector << "Sector_" << (*i_sector).first;
806  TFileDirectory secDir = fileService->mkdir(sector.str().c_str());
807 
808  // Dummy histo containing the sector name as title
809  (*i_sector).second.Name = secDir.make<TH1F>("z_name",(*i_sector).second.name.c_str(),1,0,1);
810 
811  // Do not book histos for empty sectors
812  if((*i_sector).second.v_rawId.size()==0){
813  continue;
814  }
815 
816 
817  // Distributions in each interval (stay in [cm], to have all calculations in [cm])
818  if(m_resErrBins_.size()==0){m_resErrBins_[1].first = 0.;m_resErrBins_[1].second = 0.01;} // default if no selection taken into account: calculate APE with one bin with residual error 0-100um
819  for(std::map<unsigned int,std::pair<double,double> >::const_iterator i_errBins = m_resErrBins_.begin();
820  i_errBins != m_resErrBins_.end(); ++i_errBins){
821  std::stringstream interval; interval << "Interval_" << (*i_errBins).first;
822  TFileDirectory intDir = secDir.mkdir(interval.str().c_str());
823  (*i_sector).second.m_binnedHists[(*i_errBins).first]["sigmaX"] = intDir.make<TH1F>("h_sigmaX","residual resolution #sigma_{x};#sigma_{x} [cm];# hits",100,0.,0.01);
824  (*i_sector).second.m_binnedHists[(*i_errBins).first]["norResX"] = intDir.make<TH1F>("h_norResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-10,10);
825  if((*i_sector).second.isPixel){
826  (*i_sector).second.m_binnedHists[(*i_errBins).first]["sigmaY"] = intDir.make<TH1F>("h_sigmaY","residual resolution #sigma_{y};#sigma_{y} [cm];# hits",100,0.,0.01);
827  (*i_sector).second.m_binnedHists[(*i_errBins).first]["norResY"] = intDir.make<TH1F>("h_norResY","normalized residual r_{y}/#sigma_{r,y};(y_{trk}-y_{hit})/#sigma_{r,y};# hits",100,-10,10);
828  }
829  }
830 
831 
832  TFileDirectory resDir = secDir.mkdir("Results");
833 
834  // TTree containing rawIds of all modules in sector
835  unsigned int rawId(0);
836  (*i_sector).second.RawId = resDir.make<TTree>("rawIdTree","Tree containing rawIds of all modules in sector");
837  (*i_sector).second.RawId->Branch("RawId", &rawId, "RawId/i");
838  for(std::vector<unsigned int>::const_iterator i_rawId=(*i_sector).second.v_rawId.begin(); i_rawId!=(*i_sector).second.v_rawId.end(); ++i_rawId){
839  rawId = (*i_rawId);
840  (*i_sector).second.RawId->Fill();
841  }
842 
843  // Result plots (one hist per sector containing one bin per interval)
844  // (transform errors and residuals from [cm] in [mum])
845  std::vector<double> v_binX(parameterSet_.getParameter<std::vector<double> >("residualErrorBinning"));
846  for(std::vector<double>::iterator i_binX = v_binX.begin(); i_binX != v_binX.end(); ++i_binX){
847  *i_binX *= 10000.;
848  }
849  (*i_sector).second.EntriesX = resDir.make<TH1F>("h_entriesX","# hits used;#sigma_{x} [#mum];# hits",v_binX.size()-1,&(v_binX[0]));
850  if((*i_sector).second.isPixel){
851  (*i_sector).second.EntriesY = resDir.make<TH1F>("h_entriesY","# hits used;#sigma_{y} [#mum];# hits",v_binX.size()-1,&(v_binX[0]));
852  }
853 
854  // In fact these are un-needed Analyzer plots, but I want to have them always for every sector visible
855  // (transform errors and residuals from [cm] in [mum])
856  (*i_sector).second.ResX = resDir.make<TH1F>("h_ResX","residual r_{x};x_{trk}-x_{hit} [#mum];# hits",100,-0.03*10000.,0.03*10000.);
857  (*i_sector).second.NorResX = resDir.make<TH1F>("h_NorResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-5.,5.);
858  if((*i_sector).second.isPixel){
859  (*i_sector).second.ResY = resDir.make<TH1F>("h_ResY","residual r_{y};y_{trk}-y_{hit} [#mum];# hits",100,-0.03*10000.,0.03*10000.);
860  (*i_sector).second.NorResY = resDir.make<TH1F>("h_NorResY","normalized residual r_{y}/#sigma_{r,y};(y_{trk}-y_{hit})/#sigma_{r,y};# hits",100,-5.,5.);
861  }
862  }
863 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
tuple interval
Definition: MergeJob_cfg.py:20
std::map< unsigned int, std::pair< double, double > > m_resErrBins_
T * make(const Args &...args) const
make new ROOT object
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::Service< TFileService > fileService
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
void ApeEstimator::bookTrackHists ( )
private

Definition at line 872 of file ApeEstimator.cc.

References TrackerDetectorStruct::Charge, TrackerDetectorStruct::Chi2, TrackerDetectorStruct::D0Beamspot, TrackerDetectorStruct::D0BeamspotErr, TrackerDetectorStruct::D0BeamspotSig, TrackerDetectorStruct::Dz, TrackerDetectorStruct::DzErr, TrackerDetectorStruct::DzSig, TrackerDetectorStruct::Eta, TrackerDetectorStruct::EtaErr, TrackerDetectorStruct::EtaSig, fileService, edm::ParameterSet::getParameter(), TrackerDetectorStruct::Hits2D, TrackerDetectorStruct::HitsGood, TrackerDetectorStruct::HitsGoodVsHitsValid, TrackerDetectorStruct::HitsInvalid, TrackerDetectorStruct::HitsPixel, TrackerDetectorStruct::HitsPixelVsEta, TrackerDetectorStruct::HitsPixelVsTheta, TrackerDetectorStruct::HitsSize, TrackerDetectorStruct::HitsStrip, TrackerDetectorStruct::HitsStripVsEta, TrackerDetectorStruct::HitsStripVsTheta, TrackerDetectorStruct::HitsValid, TrackerDetectorStruct::LayersMissed, TFileDirectory::make(), TrackerDetectorStruct::MeanAngle, TrackerDetectorStruct::MeanAngleVsHits, TFileService::mkdir(), TrackerDetectorStruct::Ndof, TrackerDetectorStruct::NorChi2, TrackerDetectorStruct::P, parameterSet_, TrackerDetectorStruct::Phi, TrackerDetectorStruct::PhiErr, TrackerDetectorStruct::PhiSig, TrackerDetectorStruct::PHitsGoodVsHitsValid, TrackerDetectorStruct::PHitsPixelVsEta, TrackerDetectorStruct::PHitsPixelVsTheta, TrackerDetectorStruct::PHitsStripVsEta, TrackerDetectorStruct::PHitsStripVsTheta, TrackerDetectorStruct::PMeanAngleVsHits, TrackerDetectorStruct::PPtVsEta, TrackerDetectorStruct::PPtVsTheta, TrackerDetectorStruct::Prob, TrackerDetectorStruct::Pt, TrackerDetectorStruct::PtErr, TrackerDetectorStruct::PtSig, TrackerDetectorStruct::PtVsEta, TrackerDetectorStruct::PtVsTheta, TrackerDetectorStruct::Theta, tkDetector_, TrackerDetectorStruct::TrkSize, and TrackerDetectorStruct::TrkSizeGood.

Referenced by beginJob().

872  {
873 
874  bool zoomHists(parameterSet_.getParameter<bool>("zoomHists"));
875 
876  int trackSizeBins = zoomHists ? 6 : 201;
877  double trackSizeMax = trackSizeBins -1;
878 
879  double chi2Max = zoomHists ? 100. : 2000.;
880  double norChi2Max = zoomHists ? 5. : 1000.;
881  double d0max = zoomHists ? 0.02 : 40.; // cosmics: 100.|100.
882  double dzmax = zoomHists ? 15. : 100.; // cosmics: 200.|600.
883  double pMax = zoomHists ? 200. : 2000.;
884 
886  TFileDirectory evtDir = fileService->mkdir("EventVariables");
887  tkDetector_.TrkSize = evtDir.make<TH1F>("h_trackSize","# tracks [all];# tracks;# events",trackSizeBins,-1,trackSizeMax);
888  tkDetector_.TrkSizeGood = evtDir.make<TH1F>("h_trackSizeGood","# tracks [good];# tracks;# events",trackSizeBins,-1,trackSizeMax);
889  TFileDirectory trkDir = fileService->mkdir("TrackVariables");
890  tkDetector_.HitsSize = trkDir.make<TH1F>("h_hitsSize","# hits;# hits;# tracks",51,-1,50);
891  tkDetector_.HitsValid = trkDir.make<TH1F>("h_hitsValid","# hits [valid];# hits [valid];# tracks",51,-1,50);
892  tkDetector_.HitsInvalid = trkDir.make<TH1F>("h_hitsInvalid","# hits [invalid];# hits [invalid];# tracks",21,-1,20);
893  tkDetector_.Hits2D = trkDir.make<TH1F>("h_hits2D","# hits [2D];# hits [2D];# tracks",21,-1,20);
894  tkDetector_.LayersMissed = trkDir.make<TH1F>("h_layersMissed","# layers [missed];# layers [missed];# tracks",11,-1,10);
895  tkDetector_.HitsPixel = trkDir.make<TH1F>("h_hitsPixel","# hits [pixel];# hits [pixel];# tracks",11,-1,10);
896  tkDetector_.HitsStrip = trkDir.make<TH1F>("h_hitsStrip","# hits [strip];# hits [strip];# tracks",41,-1,40);
897  tkDetector_.Charge = trkDir.make<TH1F>("h_charge","charge q;q [e];# tracks",5,-2,3);
898  tkDetector_.Chi2 = trkDir.make<TH1F>("h_chi2"," #chi^{2};#chi^{2};# tracks",100,0,chi2Max);
899  tkDetector_.Ndof = trkDir.make<TH1F>("h_ndof","# degrees of freedom f;f;# tracks",101,-1,100);
900  tkDetector_.NorChi2 = trkDir.make<TH1F>("h_norChi2","normalized #chi^{2};#chi^{2}/f;# tracks",200,0,norChi2Max);
901  tkDetector_.Prob = trkDir.make<TH1F>("h_prob"," #chi^{2} probability;prob(#chi^{2},f);# tracks",50,0,1);
902  tkDetector_.Eta = trkDir.make<TH1F>("h_eta","pseudorapidity #eta;#eta;# tracks",100,-5,5);
903  tkDetector_.EtaErr = trkDir.make<TH1F>("h_etaErr","Error of #eta;#sigma(#eta);# tracks",100,0,0.001);
904  tkDetector_.EtaSig = trkDir.make<TH1F>("h_etaSig","Significance of #eta;#eta/#sigma(#eta);# tracks",100,-20000,20000);
905  tkDetector_.Theta = trkDir.make<TH1F>("h_theta","polar angle #theta;#theta [ ^{o}];# tracks",100,-10,190);
906  tkDetector_.Phi = trkDir.make<TH1F>("h_phi","azimuth angle #phi;#phi [ ^{o}];# tracks",190,-190,190);
907  tkDetector_.PhiErr = trkDir.make<TH1F>("h_phiErr","Error of #phi;#sigma(#phi) [ ^{o}];# tracks",100,0,0.04);
908  tkDetector_.PhiSig = trkDir.make<TH1F>("h_phiSig","Significance of #phi;#phi/#sigma(#phi) [ ^{o}];# tracks",100,-50000,50000);
909  tkDetector_.D0Beamspot = trkDir.make<TH1F>("h_d0Beamspot","Closest approach d_{0} wrt. beamspot;d_{0, BS} [cm];# tracks",200,-d0max,d0max);
910  tkDetector_.D0BeamspotErr = trkDir.make<TH1F>("h_d0BeamspotErr","Error of d_{0, BS};#sigma(d_{0, BS}) [cm];# tracks",200,0,0.01);
911  tkDetector_.D0BeamspotSig = trkDir.make<TH1F>("h_d0BeamspotSig","Significance of d_{0, BS};d_{0, BS}/#sigma(d_{0, BS});# tracks",100,-5,5);
912  tkDetector_.Dz = trkDir.make<TH1F>("h_dz","Closest approach d_{z};d_{z} [cm];# tracks",200,-dzmax,dzmax);
913  tkDetector_.DzErr = trkDir.make<TH1F>("h_dzErr","Error of d_{z};#sigma(d_{z}) [cm];# tracks",200,0,0.01);
914  tkDetector_.DzSig = trkDir.make<TH1F>("h_dzSig","Significance of d_{z};d_{z}/#sigma(d_{z});# tracks",100,-10000,10000);
915  tkDetector_.Pt = trkDir.make<TH1F>("h_pt","transverse momentum p_{t};p_{t} [GeV];# tracks",100,0,pMax);
916  tkDetector_.PtErr = trkDir.make<TH1F>("h_ptErr","Error of p_{t};#sigma(p_{t}) [GeV];# tracks",100,0,1.6);
917  tkDetector_.PtSig = trkDir.make<TH1F>("h_ptSig","Significance of p_{t};p_{t}/#sigma(p_{t});# tracks",100,0,200);
918  tkDetector_.P = trkDir.make<TH1F>("h_p","momentum magnitude |p|;|p| [GeV];# tracks",100,0,pMax);
919  tkDetector_.MeanAngle = trkDir.make<TH1F>("h_meanAngle","mean angle on module <#phi_{module}>;<#phi_{module}> [ ^{o}];# tracks",100,-5,95);
920  tkDetector_.HitsGood = trkDir.make<TH1F>("h_hitsGood","# hits [good];# hits [good];# tracks",51,-1,50);
921 
922  tkDetector_.MeanAngleVsHits = trkDir.make<TH2F>("h2_meanAngleVsHits","<#phi_{module}> vs. # hits;# hits;<#phi_{module}> [ ^{o}]",51,-1,50,50,-5,95);
923  tkDetector_.HitsGoodVsHitsValid = trkDir.make<TH2F>("h2_hitsGoodVsHitsValid","# hits [good] vs. # hits [valid];# hits [valid];# hits [good]",51,-1,50,51,-1,50);
924  tkDetector_.HitsPixelVsEta = trkDir.make<TH2F>("h2_hitsPixelVsEta","# hits [pixel] vs. #eta;#eta;# hits [pixel]",60,-3,3,11,-1,10);
925  tkDetector_.HitsPixelVsTheta = trkDir.make<TH2F>("h2_hitsPixelVsTheta","# hits [pixel] vs. #theta;#theta;# hits [pixel]",100,-10,190,11,-1,10);
926  tkDetector_.HitsStripVsEta = trkDir.make<TH2F>("h2_hitsStripVsEta","# hits [strip] vs. #eta;#eta;# hits [strip]",60,-3,3,31,-1,40);
927  tkDetector_.HitsStripVsTheta = trkDir.make<TH2F>("h2_hitsStripVsTheta","# hits [strip] vs. #theta;#theta;# hits [strip]",100,-10,190,31,-1,40);
928  tkDetector_.PtVsEta = trkDir.make<TH2F>("h2_ptVsEta","p_{t} vs. #eta;#eta;p_{t} [GeV]",60,-3,3,100,0,pMax);
929  tkDetector_.PtVsTheta = trkDir.make<TH2F>("h2_ptVsTheta","p_{t} vs. #theta;#theta;p_{t} [GeV]",100,-10,190,100,0,pMax);
930 
931  tkDetector_.PMeanAngleVsHits = trkDir.make<TProfile>("p_meanAngleVsHits","<#phi_{module}> vs. # hits;# hits;<#phi_{module}> [ ^{o}]",51,-1,50);
932  tkDetector_.PHitsGoodVsHitsValid = trkDir.make<TProfile>("p_hitsGoodVsHitsValid","# hits [good] vs. # hits [valid];# hits [valid];# hits [good]",51,-1,50);
933  tkDetector_.PHitsPixelVsEta = trkDir.make<TProfile>("p_hitsPixelVsEta","# hits [pixel] vs. #eta;#eta;# hits [pixel]",60,-3,3);
934  tkDetector_.PHitsPixelVsTheta = trkDir.make<TProfile>("p_hitsPixelVsTheta","# hits [pixel] vs. #theta;#theta;# hits [pixel]",100,-10,190);
935  tkDetector_.PHitsStripVsEta = trkDir.make<TProfile>("p_hitsStripVsEta","# hits [strip] vs. #eta;#eta;# hits [strip]",60,-3,3);
936  tkDetector_.PHitsStripVsTheta = trkDir.make<TProfile>("p_hitsStripVsTheta","# hits [strip] vs. #theta;#theta;# hits [strip]",100,-10,190);
937  tkDetector_.PPtVsEta = trkDir.make<TProfile>("p_ptVsEta","p_{t} vs. #eta;#eta;p_{t} [GeV]",60,-3,3);
938  tkDetector_.PPtVsTheta = trkDir.make<TProfile>("p_ptVsTheta","p_{t} vs. #theta;#theta;p_{t} [GeV]",100,-10,190);
939 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
TrackerDetectorStruct tkDetector_
T * make(const Args &...args) const
make new ROOT object
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::Service< TFileService > fileService
void ApeEstimator::calculateAPE ( )
private

Definition at line 2088 of file ApeEstimator.cc.

References m_tkSector_, and python.multivaluedict::map().

Referenced by endJob().

2088  {
2089  // Loop over sectors for calculating APE
2090  for(std::map<unsigned int,TrackerSectorStruct>::iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
2091 
2092 
2093  // Loop over residual error bins to calculate APE for every bin
2094  for(std::map<unsigned int, std::map<std::string,TH1*> >::const_iterator i_errBins = (*i_sector).second.m_binnedHists.begin();
2095  i_errBins != (*i_sector).second.m_binnedHists.end(); ++i_errBins){
2096  std::map<std::string,TH1*> m_Hists = (*i_errBins).second;
2097 
2098  // Fitting Parameters
2099  double integralX = m_Hists["norResX"]->Integral();
2100  (*i_sector).second.EntriesX->SetBinContent((*i_errBins).first, integralX);
2101 
2102  if((*i_sector).second.isPixel){
2103  double integralY = m_Hists["norResY"]->Integral();
2104  (*i_sector).second.EntriesY->SetBinContent((*i_errBins).first, integralY);
2105  }
2106  }
2107  }
2108 }
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
bool ApeEstimator::checkIntervalsForSectors ( const unsigned int  sectorCounter,
const std::vector< double > &  v_id 
) const
private

Definition at line 431 of file ApeEstimator.cc.

Referenced by sectorBuilder().

431  {
432  if(v_id.size()==0)return true;
433  if(v_id.size()%2==1){
434  edm::LogError("SectorBuilder")<<"Incorrect Sector Definition: Position Vectors need even number of arguments (Intervals)"
435  <<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
436  return false;
437  }
438  int entry(1); double intervalBegin(999.);
439  for(std::vector<double>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id, ++entry){
440  if(entry%2==1)intervalBegin = *i_id;
441  if(entry%2==0 && intervalBegin>*i_id){
442  edm::LogError("SectorBuilder")<<"Incorrect Sector Definition (Position Vector Intervals): \t"
443  <<intervalBegin<<" is bigger than "<<*i_id<<" but is expected to be smaller"
444  <<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
445  return false;
446  }
447  }
448  return true;
449 }
bool ApeEstimator::checkModuleBools ( const bool  id,
const std::vector< unsigned int > &  v_id 
) const
private

Definition at line 461 of file ApeEstimator.cc.

Referenced by sectorBuilder().

461  {
462  if(v_id.size()==0)return true;
463  for(std::vector<unsigned int>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id){
464  if(1==*i_id && id)return true;
465  if(2==*i_id && !id)return true;
466  }
467  return false;
468 }
bool ApeEstimator::checkModuleDirections ( const int  id,
const std::vector< int > &  v_id 
) const
private

Definition at line 471 of file ApeEstimator.cc.

Referenced by sectorBuilder().

471  {
472  if(v_id.size()==0)return true;
473  for(std::vector<int>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id){
474  if(id==*i_id)return true;
475  }
476  return false;
477 }
bool ApeEstimator::checkModuleIds ( const unsigned int  id,
const std::vector< unsigned int > &  v_id 
) const
private

Definition at line 452 of file ApeEstimator.cc.

Referenced by sectorBuilder().

452  {
453  if(v_id.size()==0)return true;
454  for(std::vector<unsigned int>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id){
455  if(id==*i_id)return true;
456  }
457  return false;
458 }
bool ApeEstimator::checkModulePositions ( const float  id,
const std::vector< double > &  v_id 
) const
private

Definition at line 480 of file ApeEstimator.cc.

Referenced by sectorBuilder().

480  {
481  if(v_id.size()==0)return true;
482  int entry(1); double intervalBegin(999.);
483  for(std::vector<double>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id, ++entry){
484  if(entry%2==1)intervalBegin = *i_id;
485  if(entry%2==0 && id>=intervalBegin && id<*i_id)return true;
486  }
487  return false;
488 }
void ApeEstimator::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 2248 of file ApeEstimator.cc.

References calculateAPE(), calculateApe_, and counter1.

2248  {
2249 
2250  if(calculateApe_)this->calculateAPE();
2251 
2252  edm::LogInfo("HitSelector")<<"\nThere are "<<counter1<< " negative Errors calculated\n";
2253 }
const bool calculateApe_
unsigned int counter1
void calculateAPE()
void ApeEstimator::fillHistsForAnalyzerMode ( const TrackStruct trackStruct)
private

Definition at line 1756 of file ApeEstimator.cc.

References TrackerDetectorStruct::Charge, TrackStruct::TrackParameterStruct::charge, TrackerDetectorStruct::Chi2, TrackStruct::TrackParameterStruct::chi2, TrackerDetectorStruct::D0Beamspot, TrackStruct::TrackParameterStruct::d0Beamspot, TrackerDetectorStruct::D0BeamspotErr, TrackStruct::TrackParameterStruct::d0BeamspotErr, TrackerDetectorStruct::D0BeamspotSig, TrackerDetectorStruct::Dz, TrackStruct::TrackParameterStruct::dz, TrackerDetectorStruct::DzErr, TrackStruct::TrackParameterStruct::dzErr, TrackerDetectorStruct::DzSig, TrackStruct::HitParameterStruct::errX, TrackStruct::HitParameterStruct::errXHit, TrackStruct::HitParameterStruct::errXTrk, TrackStruct::HitParameterStruct::errY, TrackStruct::HitParameterStruct::errYHit, TrackStruct::HitParameterStruct::errYTrk, TrackerDetectorStruct::Eta, TrackStruct::TrackParameterStruct::eta, TrackerDetectorStruct::EtaErr, TrackStruct::TrackParameterStruct::etaErr, TrackerDetectorStruct::EtaSig, fillHitHistsXForAnalyzerMode(), fillHitHistsYForAnalyzerMode(), edm::ParameterSet::getParameter(), TrackStruct::HitParameterStruct::goodXMeasurement, TrackStruct::HitParameterStruct::goodYMeasurement, TrackerDetectorStruct::Hits2D, TrackStruct::TrackParameterStruct::hits2D, TrackerDetectorStruct::HitsGood, TrackerDetectorStruct::HitsGoodVsHitsValid, TrackerDetectorStruct::HitsInvalid, TrackStruct::TrackParameterStruct::hitsInvalid, TrackerDetectorStruct::HitsPixel, TrackStruct::TrackParameterStruct::hitsPixel, TrackerDetectorStruct::HitsPixelVsEta, TrackerDetectorStruct::HitsPixelVsTheta, TrackerDetectorStruct::HitsSize, TrackStruct::TrackParameterStruct::hitsSize, TrackerDetectorStruct::HitsStrip, TrackStruct::TrackParameterStruct::hitsStrip, TrackerDetectorStruct::HitsStripVsEta, TrackerDetectorStruct::HitsStripVsTheta, TrackStruct::HitParameterStruct::hitState, TrackerDetectorStruct::HitsValid, TrackStruct::TrackParameterStruct::hitsValid, TrackerDetectorStruct::LayersMissed, TrackStruct::TrackParameterStruct::layersMissed, TrackerSectorStruct::m_correlationHistsX, TrackerSectorStruct::m_correlationHistsY, M_PI, TrackerSectorStruct::m_sigmaX, TrackerSectorStruct::m_sigmaY, m_tkSector_, python.multivaluedict::map(), TrackerDetectorStruct::MeanAngle, TrackerDetectorStruct::MeanAngleVsHits, TrackStruct::TrackParameterStruct::meanPhiSensToNorm, minGoodHitsPerTrack_, TrackerDetectorStruct::Ndof, TrackStruct::TrackParameterStruct::ndof, TrackerDetectorStruct::NorChi2, TrackStruct::TrackParameterStruct::norChi2, TrackStruct::notAssignedToSectors, TrackerDetectorStruct::P, TrackStruct::TrackParameterStruct::p, parameterSet_, TrackerDetectorStruct::Phi, TrackStruct::TrackParameterStruct::phi, TrackerDetectorStruct::PhiErr, TrackStruct::TrackParameterStruct::phiErr, TrackerDetectorStruct::PhiSig, TrackerDetectorStruct::PHitsGoodVsHitsValid, TrackerDetectorStruct::PHitsPixelVsEta, TrackerDetectorStruct::PHitsPixelVsTheta, TrackerDetectorStruct::PHitsStripVsEta, TrackerDetectorStruct::PHitsStripVsTheta, TrackerDetectorStruct::PMeanAngleVsHits, TrackerDetectorStruct::PPtVsEta, TrackerDetectorStruct::PPtVsTheta, TrackerDetectorStruct::Prob, TrackStruct::TrackParameterStruct::prob, TrackerDetectorStruct::Pt, TrackStruct::TrackParameterStruct::pt, TrackerDetectorStruct::PtErr, TrackStruct::TrackParameterStruct::ptErr, TrackerDetectorStruct::PtSig, TrackerDetectorStruct::PtVsEta, TrackerDetectorStruct::PtVsTheta, AlCaHLTBitMon_QueryRunRegistry::string, TrackerDetectorStruct::Theta, TrackStruct::TrackParameterStruct::theta, tkDetector_, TrackStruct::trkParams, TrackStruct::v_hitParams, and TrackStruct::HitParameterStruct::v_sector.

Referenced by analyze().

1756  {
1757 
1758  unsigned int goodHitsPerTrack(trackStruct.v_hitParams.size());
1759  tkDetector_.HitsGood->Fill(goodHitsPerTrack);
1760  tkDetector_.HitsGoodVsHitsValid->Fill(trackStruct.trkParams.hitsValid,goodHitsPerTrack);
1761  tkDetector_.PHitsGoodVsHitsValid->Fill(trackStruct.trkParams.hitsValid,goodHitsPerTrack);
1762 
1763  if(parameterSet_.getParameter<bool>("applyTrackCuts")){
1764  // which tracks to take? need min. nr. of selected hits?
1765  if(goodHitsPerTrack < minGoodHitsPerTrack_)return;
1766  }
1767 
1768  tkDetector_.HitsSize ->Fill(trackStruct.trkParams.hitsSize);
1769  tkDetector_.HitsValid ->Fill(trackStruct.trkParams.hitsValid);
1770  tkDetector_.HitsInvalid ->Fill(trackStruct.trkParams.hitsInvalid);
1771  tkDetector_.Hits2D ->Fill(trackStruct.trkParams.hits2D);
1772  tkDetector_.LayersMissed ->Fill(trackStruct.trkParams.layersMissed);
1773  tkDetector_.HitsPixel ->Fill(trackStruct.trkParams.hitsPixel);
1774  tkDetector_.HitsStrip ->Fill(trackStruct.trkParams.hitsStrip);
1775  tkDetector_.Charge ->Fill(trackStruct.trkParams.charge);
1776  tkDetector_.Chi2 ->Fill(trackStruct.trkParams.chi2);
1777  tkDetector_.Ndof ->Fill(trackStruct.trkParams.ndof);
1778  tkDetector_.NorChi2 ->Fill(trackStruct.trkParams.norChi2);
1779  tkDetector_.Prob ->Fill(trackStruct.trkParams.prob);
1780  tkDetector_.Eta ->Fill(trackStruct.trkParams.eta);
1781  tkDetector_.EtaErr ->Fill(trackStruct.trkParams.etaErr);
1782  tkDetector_.EtaSig ->Fill(trackStruct.trkParams.eta/trackStruct.trkParams.etaErr);
1783  tkDetector_.Theta ->Fill(trackStruct.trkParams.theta*180./M_PI);
1784  tkDetector_.Phi ->Fill(trackStruct.trkParams.phi*180./M_PI);
1785  tkDetector_.PhiErr ->Fill(trackStruct.trkParams.phiErr*180./M_PI);
1786  tkDetector_.PhiSig ->Fill(trackStruct.trkParams.phi/trackStruct.trkParams.phiErr);
1787  tkDetector_.D0Beamspot ->Fill(trackStruct.trkParams.d0Beamspot);
1788  tkDetector_.D0BeamspotErr->Fill(trackStruct.trkParams.d0BeamspotErr);
1789  tkDetector_.D0BeamspotSig->Fill(trackStruct.trkParams.d0Beamspot/trackStruct.trkParams.d0BeamspotErr);
1790  tkDetector_.Dz ->Fill(trackStruct.trkParams.dz);
1791  tkDetector_.DzErr ->Fill(trackStruct.trkParams.dzErr);
1792  tkDetector_.DzSig ->Fill(trackStruct.trkParams.dz/trackStruct.trkParams.dzErr);
1793  tkDetector_.P ->Fill(trackStruct.trkParams.p);
1794  tkDetector_.Pt ->Fill(trackStruct.trkParams.pt);
1795  tkDetector_.PtErr ->Fill(trackStruct.trkParams.ptErr);
1796  tkDetector_.PtSig ->Fill(trackStruct.trkParams.pt/trackStruct.trkParams.ptErr);
1797  tkDetector_.MeanAngle ->Fill(trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1798 
1799  tkDetector_.MeanAngleVsHits ->Fill(trackStruct.trkParams.hitsSize,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1800  tkDetector_.HitsPixelVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsPixel);
1801  tkDetector_.HitsPixelVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsPixel);
1802  tkDetector_.HitsStripVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsStrip);
1803  tkDetector_.HitsStripVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsStrip);
1804  tkDetector_.PtVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.pt);
1805  tkDetector_.PtVsTheta ->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.pt);
1806 
1807  tkDetector_.PMeanAngleVsHits ->Fill(trackStruct.trkParams.hitsSize,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1808  tkDetector_.PHitsPixelVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsPixel);
1809  tkDetector_.PHitsPixelVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsPixel);
1810  tkDetector_.PHitsStripVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.hitsStrip);
1811  tkDetector_.PHitsStripVsTheta->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.hitsStrip);
1812  tkDetector_.PPtVsEta ->Fill(trackStruct.trkParams.eta,trackStruct.trkParams.pt);
1813  tkDetector_.PPtVsTheta ->Fill(trackStruct.trkParams.theta*180./M_PI,trackStruct.trkParams.pt);
1814 
1815 
1816  for(std::vector<TrackStruct::HitParameterStruct>::const_iterator i_hit = trackStruct.v_hitParams.begin();
1817  i_hit != trackStruct.v_hitParams.end(); ++i_hit){
1818  const TrackStruct::HitParameterStruct& hit(*i_hit);
1819  //Put here from earlier method
1820  if(hit.hitState == TrackStruct::notAssignedToSectors)continue;
1821 
1822  for(std::map<unsigned int,TrackerSectorStruct>::iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
1823  bool moduleInSector(false);
1824  for(std::vector<unsigned int>::const_iterator i_hitSector = hit.v_sector.begin(); i_hitSector != hit.v_sector.end(); ++i_hitSector){
1825  if((*i_sector).first == *i_hitSector){moduleInSector = true; break;}
1826  }
1827  if(!moduleInSector)continue;
1828  TrackerSectorStruct& sector((*i_sector).second);
1829 
1830  if(hit.goodXMeasurement){
1831  std::map<std::string,TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsX);
1832 
1833  // Cluster and Hit Parameters
1834  this->fillHitHistsXForAnalyzerMode(hit, sector);
1835 
1836  // Track Parameters
1837  m_corrHists["HitsValid"].fillCorrHistsX(hit,trackStruct.trkParams.hitsValid);
1838  m_corrHists["HitsGood"].fillCorrHistsX(hit,goodHitsPerTrack);
1839  m_corrHists["HitsInvalid"].fillCorrHistsX(hit,trackStruct.trkParams.hitsInvalid);
1840  m_corrHists["Hits2D"].fillCorrHistsX(hit,trackStruct.trkParams.hits2D);
1841  m_corrHists["LayersMissed"].fillCorrHistsX(hit,trackStruct.trkParams.layersMissed);
1842  m_corrHists["HitsPixel"].fillCorrHistsX(hit,trackStruct.trkParams.hitsPixel);
1843  m_corrHists["HitsStrip"].fillCorrHistsX(hit,trackStruct.trkParams.hitsStrip);
1844  m_corrHists["NorChi2"].fillCorrHistsX(hit,trackStruct.trkParams.norChi2);
1845  m_corrHists["Theta"].fillCorrHistsX(hit,trackStruct.trkParams.theta*180./M_PI);
1846  m_corrHists["Phi"].fillCorrHistsX(hit,trackStruct.trkParams.phi*180./M_PI);
1847  m_corrHists["D0Beamspot"].fillCorrHistsX(hit,trackStruct.trkParams.d0Beamspot);
1848  m_corrHists["Dz"].fillCorrHistsX(hit,trackStruct.trkParams.dz);
1849  m_corrHists["Pt"].fillCorrHistsX(hit,trackStruct.trkParams.pt);
1850  m_corrHists["P"].fillCorrHistsX(hit,trackStruct.trkParams.p);
1851  m_corrHists["InvP"].fillCorrHistsX(hit,1./trackStruct.trkParams.p);
1852  m_corrHists["MeanAngle"].fillCorrHistsX(hit,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1853  //m_corrHists[""].fillCorrHistsX(hit, hit.);
1854  }
1855 
1856  if(hit.goodYMeasurement){
1857  std::map<std::string,TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsY);
1858 
1859  // Cluster and Hit Parameters
1860  this->fillHitHistsYForAnalyzerMode(hit, sector);
1861 
1862  // Track Parameters
1863  m_corrHists["HitsValid"].fillCorrHistsY(hit,trackStruct.trkParams.hitsValid);
1864  m_corrHists["HitsGood"].fillCorrHistsY(hit,goodHitsPerTrack);
1865  m_corrHists["HitsInvalid"].fillCorrHistsY(hit,trackStruct.trkParams.hitsInvalid);
1866  m_corrHists["Hits2D"].fillCorrHistsY(hit,trackStruct.trkParams.hits2D);
1867  m_corrHists["LayersMissed"].fillCorrHistsY(hit,trackStruct.trkParams.layersMissed);
1868  m_corrHists["HitsPixel"].fillCorrHistsY(hit,trackStruct.trkParams.hitsPixel);
1869  m_corrHists["HitsStrip"].fillCorrHistsY(hit,trackStruct.trkParams.hitsStrip);
1870  m_corrHists["NorChi2"].fillCorrHistsY(hit,trackStruct.trkParams.norChi2);
1871  m_corrHists["Theta"].fillCorrHistsY(hit,trackStruct.trkParams.theta*180./M_PI);
1872  m_corrHists["Phi"].fillCorrHistsY(hit,trackStruct.trkParams.phi*180./M_PI);
1873  m_corrHists["D0Beamspot"].fillCorrHistsY(hit,trackStruct.trkParams.d0Beamspot);
1874  m_corrHists["Dz"].fillCorrHistsY(hit,trackStruct.trkParams.dz);
1875  m_corrHists["Pt"].fillCorrHistsY(hit,trackStruct.trkParams.pt);
1876  m_corrHists["P"].fillCorrHistsY(hit,trackStruct.trkParams.p);
1877  m_corrHists["InvP"].fillCorrHistsY(hit,1./trackStruct.trkParams.p);
1878  m_corrHists["MeanAngle"].fillCorrHistsY(hit,trackStruct.trkParams.meanPhiSensToNorm*180./M_PI);
1879  }
1880 
1881  // Special Histograms
1882  for(std::map<std::string,std::vector<TH1*> >::iterator i_sigmaX = sector.m_sigmaX.begin(); i_sigmaX != sector.m_sigmaX.end(); ++i_sigmaX){
1883  for(std::vector<TH1*>::iterator iHist = (*i_sigmaX).second.begin(); iHist != (*i_sigmaX).second.end(); ++iHist){
1884  if ((*i_sigmaX).first=="sigmaXHit")(*iHist)->Fill(hit.errXHit*10000.);
1885  else if((*i_sigmaX).first=="sigmaXTrk")(*iHist)->Fill(hit.errXTrk*10000.);
1886  else if((*i_sigmaX).first=="sigmaX") (*iHist)->Fill(hit.errX*10000.);
1887  }
1888  }
1889  for(std::map<std::string,std::vector<TH1*> >::iterator i_sigmaY = sector.m_sigmaY.begin(); i_sigmaY != sector.m_sigmaY.end(); ++i_sigmaY){
1890  for(std::vector<TH1*>::iterator iHist = (*i_sigmaY).second.begin(); iHist != (*i_sigmaY).second.end(); ++iHist){
1891  if ((*i_sigmaY).first=="sigmaYHit")(*iHist)->Fill(hit.errYHit*10000.);
1892  else if((*i_sigmaY).first=="sigmaYTrk")(*iHist)->Fill(hit.errYTrk*10000.);
1893  else if((*i_sigmaY).first=="sigmaY") (*iHist)->Fill(hit.errY*10000.);
1894  }
1895  }
1896  }
1897  }
1898 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
void fillHitHistsYForAnalyzerMode(const TrackStruct::HitParameterStruct &, TrackerSectorStruct &)
TrackerDetectorStruct tkDetector_
std::vector< HitParameterStruct > v_hitParams
TrackParameterStruct trkParams
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
#define M_PI
const unsigned int minGoodHitsPerTrack_
void fillHitHistsXForAnalyzerMode(const TrackStruct::HitParameterStruct &, TrackerSectorStruct &)
void ApeEstimator::fillHistsForApeCalculation ( const TrackStruct trackStruct)
private

Definition at line 2017 of file ApeEstimator.cc.

References calculateApe_, edm::ParameterSet::getParameter(), m_resErrBins_, m_tkSector_, python.multivaluedict::map(), minGoodHitsPerTrack_, TrackStruct::notAssignedToSectors, parameterSet_, and TrackStruct::v_hitParams.

Referenced by analyze().

2017  {
2018 
2019  unsigned int goodHitsPerTrack(trackStruct.v_hitParams.size());
2020 
2021  if(parameterSet_.getParameter<bool>("applyTrackCuts")){
2022  // which tracks to take? need min. nr. of selected hits?
2023  if(goodHitsPerTrack < minGoodHitsPerTrack_)return;
2024  }
2025 
2026 
2027  for(std::vector<TrackStruct::HitParameterStruct>::const_iterator i_hit = trackStruct.v_hitParams.begin();
2028  i_hit != trackStruct.v_hitParams.end(); ++i_hit){
2029  // Put here from earlier method
2030  if(i_hit->hitState == TrackStruct::notAssignedToSectors)continue;
2031 
2032  for(std::map<unsigned int,TrackerSectorStruct>::iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
2033 
2034  bool moduleInSector(false);
2035  for(std::vector<unsigned int>::const_iterator i_hitSector = (*i_hit).v_sector.begin(); i_hitSector != (*i_hit).v_sector.end(); ++i_hitSector){
2036  if((*i_sector).first == *i_hitSector){moduleInSector = true; break;}
2037  }
2038  if(!moduleInSector)continue;
2039 
2040 
2041  if(!calculateApe_)continue;
2042 
2043  if((*i_hit).goodXMeasurement){
2044  for(std::map<unsigned int,std::pair<double,double> >::const_iterator i_errBins = m_resErrBins_.begin();
2045  i_errBins != m_resErrBins_.end(); ++i_errBins){
2046  // Separate the bins for residual resolution w/o APE, to be consistent within iterations where APE will change (have same hit always in same bin)
2047  // So also fill this value in the histogram sigmaX
2048  // But of course use the normalized residual regarding the APE to have its influence in its width
2049  if((*i_hit).errXWoApe < (*i_errBins).second.first || (*i_hit).errXWoApe >= (*i_errBins).second.second){
2050  continue;
2051  }
2052  (*i_sector).second.m_binnedHists[(*i_errBins).first]["sigmaX"] ->Fill((*i_hit).errXWoApe);
2053  (*i_sector).second.m_binnedHists[(*i_errBins).first]["norResX"]->Fill((*i_hit).norResX);
2054  break;
2055  }
2056  (*i_sector).second.ResX->Fill((*i_hit).resX*10000.);
2057  (*i_sector).second.NorResX->Fill((*i_hit).norResX);
2058  }
2059 
2060  if((*i_hit).goodYMeasurement){
2061  for(std::map<unsigned int,std::pair<double,double> >::const_iterator i_errBins = m_resErrBins_.begin();
2062  i_errBins != m_resErrBins_.end(); ++i_errBins){
2063  // Separate the bins for residual resolution w/o APE, to be consistent within iterations where APE will change (have same hit always in same bin)
2064  // So also fill this value in the histogram sigmaY
2065  // But of course use the normalized residual regarding the APE to have its influence in its width
2066  if((*i_hit).errYWoApe < (*i_errBins).second.first || (*i_hit).errYWoApe >= (*i_errBins).second.second){
2067  continue;
2068  }
2069  (*i_sector).second.m_binnedHists[(*i_errBins).first]["sigmaY"] ->Fill((*i_hit).errYWoApe);
2070  (*i_sector).second.m_binnedHists[(*i_errBins).first]["norResY"]->Fill((*i_hit).norResY);
2071  break;
2072  }
2073  (*i_sector).second.ResY->Fill((*i_hit).resY*10000.);
2074  (*i_sector).second.NorResY->Fill((*i_hit).norResY);
2075  }
2076  }
2077  }
2078 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
const bool calculateApe_
std::map< unsigned int, std::pair< double, double > > m_resErrBins_
std::vector< HitParameterStruct > v_hitParams
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
const unsigned int minGoodHitsPerTrack_
void ApeEstimator::fillHitHistsXForAnalyzerMode ( const TrackStruct::HitParameterStruct hit,
TrackerSectorStruct sector 
)
private

Definition at line 1903 of file ApeEstimator.cc.

References TrackStruct::HitParameterStruct::baryStripX, TrackStruct::HitParameterStruct::chargeAsymmetry, TrackStruct::HitParameterStruct::chargeLRminus, TrackStruct::HitParameterStruct::chargeLRplus, TrackStruct::HitParameterStruct::chargeOnEdges, TrackStruct::HitParameterStruct::chargePixel, TrackStruct::HitParameterStruct::chargeStrip, TrackStruct::HitParameterStruct::clusterProbabilityQ, TrackStruct::HitParameterStruct::clusterProbabilityXY, TrackStruct::HitParameterStruct::clusterProbabilityXYQ, TrackStruct::HitParameterStruct::errX, TrackStruct::HitParameterStruct::errX2, TrackStruct::HitParameterStruct::errXHit, TrackStruct::HitParameterStruct::errXTrk, TrackStruct::HitParameterStruct::hasBadPixels, TrackStruct::HitParameterStruct::isOnEdge, TrackStruct::HitParameterStruct::isPixelHit, TrackStruct::HitParameterStruct::logClusterProbability, TrackerSectorStruct::m_correlationHistsX, M_PI, TrackStruct::HitParameterStruct::maxCharge, TrackStruct::HitParameterStruct::maxIndex, TrackStruct::HitParameterStruct::maxStrip, TrackStruct::HitParameterStruct::norResX, TrackerSectorStruct::NorResX, TrackStruct::HitParameterStruct::phiSens, TrackStruct::HitParameterStruct::phiSensX, TrackerSectorStruct::PhiSensXVsBarycentreX, TrackStruct::HitParameterStruct::phiSensY, TrackerSectorStruct::PPhiSensXVsBarycentreX, TrackStruct::HitParameterStruct::probX, TrackerSectorStruct::ProbX, TrackStruct::HitParameterStruct::projWidth, TrackerSectorStruct::PWidthDiffVsMaxStrip, TrackerSectorStruct::PWidthDiffVsSigmaXHit, TrackerSectorStruct::PWidthVsPhiSensX, TrackerSectorStruct::PWidthVsWidthProjected, TrackStruct::HitParameterStruct::qBin, TrackStruct::HitParameterStruct::resX, TrackerSectorStruct::ResX, TrackerSectorStruct::SigmaX2, TrackStruct::HitParameterStruct::sOverN, TrackStruct::HitParameterStruct::spansTwoRoc, TrackerSectorStruct::WidthDiffVsMaxStrip, TrackerSectorStruct::WidthDiffVsSigmaXHit, TrackerSectorStruct::WidthVsPhiSensX, TrackerSectorStruct::WidthVsWidthProjected, TrackStruct::HitParameterStruct::widthX, TrackStruct::HitParameterStruct::xHit, TrackerSectorStruct::XHit, TrackStruct::HitParameterStruct::xTrk, and TrackerSectorStruct::XTrk.

Referenced by fillHistsForAnalyzerMode().

1903  {
1904  std::map<std::string, TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsX);
1905 
1906  // Cluster Parameters
1907  m_corrHists["WidthX"].fillCorrHistsX(hit, hit.widthX);
1908  m_corrHists["BaryStripX"].fillCorrHistsX(hit, hit.baryStripX);
1909 
1910  if(hit.isPixelHit){
1911  m_corrHists["ChargePixel"].fillCorrHistsX(hit, hit.chargePixel);
1912  m_corrHists["ClusterProbXY"].fillCorrHistsX(hit, hit.clusterProbabilityXY);
1913  m_corrHists["ClusterProbQ"].fillCorrHistsX(hit, hit.clusterProbabilityQ);
1914  m_corrHists["ClusterProbXYQ"].fillCorrHistsX(hit, hit.clusterProbabilityXYQ);
1915  m_corrHists["LogClusterProb"].fillCorrHistsX(hit, hit.logClusterProbability);
1916  m_corrHists["IsOnEdge"].fillCorrHistsX(hit, hit.isOnEdge);
1917  m_corrHists["HasBadPixels"].fillCorrHistsX(hit, hit.hasBadPixels);
1918  m_corrHists["SpansTwoRoc"].fillCorrHistsX(hit, hit.spansTwoRoc);
1919  m_corrHists["QBin"].fillCorrHistsX(hit, hit.qBin);
1920 
1921  }
1922  else{
1923  m_corrHists["ChargeStrip"].fillCorrHistsX(hit, hit.chargeStrip);
1924  m_corrHists["MaxStrip"].fillCorrHistsX(hit, hit.maxStrip);
1925  m_corrHists["MaxCharge"].fillCorrHistsX(hit, hit.maxCharge);
1926  m_corrHists["MaxIndex"].fillCorrHistsX(hit, hit.maxIndex);
1927  m_corrHists["ChargeOnEdges"].fillCorrHistsX(hit, hit.chargeOnEdges);
1928  m_corrHists["ChargeAsymmetry"].fillCorrHistsX(hit, hit.chargeAsymmetry);
1929  m_corrHists["ChargeLRplus"].fillCorrHistsX(hit, hit.chargeLRplus);
1930  m_corrHists["ChargeLRminus"].fillCorrHistsX(hit, hit.chargeLRminus);
1931  m_corrHists["SOverN"].fillCorrHistsX(hit, hit.sOverN);
1932  m_corrHists["WidthProj"].fillCorrHistsX(hit, hit.projWidth);
1933  m_corrHists["WidthDiff"].fillCorrHistsX(hit, hit.projWidth-static_cast<float>( hit.widthX));
1934 
1935  sector.WidthVsWidthProjected->Fill( hit.projWidth, hit.widthX);
1936  sector.PWidthVsWidthProjected->Fill( hit.projWidth, hit.widthX);
1937 
1938  sector.WidthDiffVsMaxStrip->Fill( hit.maxStrip, hit.projWidth-static_cast<float>( hit.widthX));
1939  sector.PWidthDiffVsMaxStrip->Fill( hit.maxStrip, hit.projWidth-static_cast<float>( hit.widthX));
1940 
1941  sector.WidthDiffVsSigmaXHit->Fill( hit.errXHit, hit.projWidth-static_cast<float>( hit.widthX));
1942  sector.PWidthDiffVsSigmaXHit->Fill( hit.errXHit, hit.projWidth-static_cast<float>( hit.widthX));
1943 
1944  sector.WidthVsPhiSensX->Fill( hit.phiSensX*180./M_PI, hit.widthX);
1945  sector.PWidthVsPhiSensX->Fill( hit.phiSensX*180./M_PI, hit.widthX);
1946  }
1947 
1948  // Hit Parameters
1949  m_corrHists["SigmaXHit"].fillCorrHistsX(hit, hit.errXHit*10000.);
1950  m_corrHists["SigmaXTrk"].fillCorrHistsX(hit, hit.errXTrk*10000.);
1951  m_corrHists["SigmaX"].fillCorrHistsX(hit, hit.errX*10000.);
1952 
1953  m_corrHists["PhiSens"].fillCorrHistsX(hit, hit.phiSens*180./M_PI);
1954  m_corrHists["PhiSensX"].fillCorrHistsX(hit, hit.phiSensX*180./M_PI);
1955  m_corrHists["PhiSensY"].fillCorrHistsX(hit, hit.phiSensY*180./M_PI);
1956 
1957  sector.XHit ->Fill(hit.xHit);
1958  sector.XTrk ->Fill(hit.xTrk);
1959  sector.SigmaX2->Fill(hit.errX2*10000.*10000.);
1960 
1961  sector.ResX ->Fill(hit.resX*10000.);
1962  sector.NorResX->Fill(hit.norResX);
1963 
1964  sector.ProbX->Fill(hit.probX);
1965 
1966  sector.PhiSensXVsBarycentreX->Fill(hit.baryStripX, hit.phiSensX*180./M_PI);
1967  sector.PPhiSensXVsBarycentreX->Fill(hit.baryStripX, hit.phiSensX*180./M_PI);
1968 }
TProfile * PPhiSensXVsBarycentreX
TProfile * PWidthVsWidthProjected
#define M_PI
std::map< std::string, CorrelationHists > m_correlationHistsX
TProfile * PWidthDiffVsSigmaXHit
void ApeEstimator::fillHitHistsYForAnalyzerMode ( const TrackStruct::HitParameterStruct hit,
TrackerSectorStruct sector 
)
private

Definition at line 1973 of file ApeEstimator.cc.

References TrackStruct::HitParameterStruct::baryStripY, TrackStruct::HitParameterStruct::chargePixel, TrackStruct::HitParameterStruct::clusterProbabilityQ, TrackStruct::HitParameterStruct::clusterProbabilityXY, TrackStruct::HitParameterStruct::clusterProbabilityXYQ, TrackStruct::HitParameterStruct::errY, TrackStruct::HitParameterStruct::errY2, TrackStruct::HitParameterStruct::errYHit, TrackStruct::HitParameterStruct::errYTrk, TrackStruct::HitParameterStruct::hasBadPixels, TrackStruct::HitParameterStruct::isOnEdge, TrackStruct::HitParameterStruct::isPixelHit, TrackStruct::HitParameterStruct::logClusterProbability, TrackerSectorStruct::m_correlationHistsY, M_PI, TrackStruct::HitParameterStruct::norResY, TrackerSectorStruct::NorResY, TrackStruct::HitParameterStruct::phiSens, TrackStruct::HitParameterStruct::phiSensX, TrackStruct::HitParameterStruct::phiSensY, TrackerSectorStruct::PhiSensYVsBarycentreY, TrackerSectorStruct::PPhiSensYVsBarycentreY, TrackStruct::HitParameterStruct::probY, TrackerSectorStruct::ProbY, TrackStruct::HitParameterStruct::qBin, TrackStruct::HitParameterStruct::resY, TrackerSectorStruct::ResY, TrackerSectorStruct::SigmaY2, TrackStruct::HitParameterStruct::spansTwoRoc, TrackStruct::HitParameterStruct::widthY, TrackStruct::HitParameterStruct::yHit, TrackerSectorStruct::YHit, TrackStruct::HitParameterStruct::yTrk, and TrackerSectorStruct::YTrk.

Referenced by fillHistsForAnalyzerMode().

1973  {
1974  std::map<std::string, TrackerSectorStruct::CorrelationHists>& m_corrHists(sector.m_correlationHistsY);
1975  // Do not fill anything for strip
1976  if(!hit.isPixelHit)return;
1977 
1978  // Cluster Parameters
1979  m_corrHists["WidthY"].fillCorrHistsY(hit,hit.widthY);
1980  m_corrHists["BaryStripY"].fillCorrHistsY(hit,hit.baryStripY);
1981 
1982  m_corrHists["ChargePixel"].fillCorrHistsY(hit, hit.chargePixel);
1983  m_corrHists["ClusterProbXY"].fillCorrHistsY(hit, hit.clusterProbabilityXY);
1984  m_corrHists["ClusterProbQ"].fillCorrHistsY(hit, hit.clusterProbabilityQ);
1985  m_corrHists["ClusterProbXYQ"].fillCorrHistsY(hit, hit.clusterProbabilityXYQ);
1986  m_corrHists["LogClusterProb"].fillCorrHistsY(hit, hit.logClusterProbability);
1987  m_corrHists["IsOnEdge"].fillCorrHistsY(hit, hit.isOnEdge);
1988  m_corrHists["HasBadPixels"].fillCorrHistsY(hit, hit.hasBadPixels);
1989  m_corrHists["SpansTwoRoc"].fillCorrHistsY(hit, hit.spansTwoRoc);
1990  m_corrHists["QBin"].fillCorrHistsY(hit, hit.qBin);
1991 
1992  // Hit Parameters
1993  m_corrHists["SigmaYHit"].fillCorrHistsY(hit, hit.errYHit*10000.);
1994  m_corrHists["SigmaYTrk"].fillCorrHistsY(hit, hit.errYTrk*10000.);
1995  m_corrHists["SigmaY"].fillCorrHistsY(hit, hit.errY*10000.);
1996 
1997  m_corrHists["PhiSens"].fillCorrHistsY(hit, hit.phiSens*180./M_PI);
1998  m_corrHists["PhiSensX"].fillCorrHistsY(hit, hit.phiSensX*180./M_PI);
1999  m_corrHists["PhiSensY"].fillCorrHistsY(hit, hit.phiSensY*180./M_PI);
2000 
2001  sector.YHit ->Fill(hit.yHit);
2002  sector.YTrk ->Fill(hit.yTrk);
2003  sector.SigmaY2->Fill(hit.errY2*10000.*10000.);
2004 
2005  sector.ResY ->Fill(hit.resY*10000.);
2006  sector.NorResY->Fill(hit.norResY);
2007 
2008  sector.ProbY->Fill(hit.probY);
2009 
2010  sector.PhiSensYVsBarycentreY->Fill(hit.baryStripY, hit.phiSensY*180./M_PI);
2011  sector.PPhiSensYVsBarycentreY->Fill(hit.baryStripY, hit.phiSensY*180./M_PI);
2012 }
#define M_PI
std::map< std::string, CorrelationHists > m_correlationHistsY
TrackStruct::HitParameterStruct ApeEstimator::fillHitVariables ( const TrajectoryMeasurement i_meas,
const edm::EventSetup iSetup 
)
private

Definition at line 1021 of file ApeEstimator.cc.

References TrajectoryMeasurement::backwardPredictedState(), SiStripClusterInfo::baryStrip(), TrackStruct::HitParameterStruct::baryStripX, TrackStruct::HitParameterStruct::baryStripY, ecalTB2006H4_GenSimDigiReco_cfg::bField, Surface::bounds(), SiStripClusterInfo::charge(), SiPixelCluster::charge(), TrackStruct::HitParameterStruct::chargeAsymmetry, SiStripClusterInfo::chargeLR(), TrackStruct::HitParameterStruct::chargeLRminus, TrackStruct::HitParameterStruct::chargeLRplus, TrackStruct::HitParameterStruct::chargeOnEdges, TrackStruct::HitParameterStruct::chargePixel, TrackStruct::HitParameterStruct::chargeStrip, SiStripRecHit1D::cluster(), SiStripRecHit2D::cluster(), SiPixelRecHit::cluster(), SiPixelRecHit::clusterProbability(), TrackStruct::HitParameterStruct::clusterProbabilityQ, TrackStruct::HitParameterStruct::clusterProbabilityXY, TrackStruct::HitParameterStruct::clusterProbabilityXYQ, counter1, gather_cfg::cout, DetId::det(), TrackingRecHit::detUnit(), TrackStruct::HitParameterStruct::errX, TrackStruct::HitParameterStruct::errX2, TrackStruct::HitParameterStruct::errXHit, TrackStruct::HitParameterStruct::errXHitWoApe, TrackStruct::HitParameterStruct::errXTrk, TrackStruct::HitParameterStruct::errXWoApe, TrackStruct::HitParameterStruct::errY, TrackStruct::HitParameterStruct::errY2, TrackStruct::HitParameterStruct::errYHit, TrackStruct::HitParameterStruct::errYHitWoApe, TrackStruct::HitParameterStruct::errYTrk, TrackStruct::HitParameterStruct::errYWoApe, F(), TrajectoryMeasurement::forwardPredictedState(), GeomDet::geographicalId(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), SiStripLorentzAngle::getLorentzAngle(), TrackStruct::HitParameterStruct::hasBadPixels, SiPixelRecHit::hasBadPixels(), TrackingRecHit::hit(), TrackStruct::HitParameterStruct::hitState, TrackStruct::invalid, SiStripClusterInfo::IsModuleUsable(), TrackStruct::HitParameterStruct::isModuleUsable, TrackStruct::HitParameterStruct::isOnEdge, SiPixelRecHit::isOnEdge(), TrackStruct::HitParameterStruct::isPixelHit, TrackingRecHit::isValid(), Bounds::length(), TrackerGeomDet::localAlignmentError(), TrajectoryStateOnSurface::localDirection(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPosition(), TrackingRecHit::localPositionError(), TrackStruct::HitParameterStruct::logClusterProbability, m_tkSector_, m_tkTreeVar_, SiStripClusterInfo::maxCharge(), TrackStruct::HitParameterStruct::maxCharge, SiStripClusterInfo::maxIndex(), TrackStruct::HitParameterStruct::maxIndex, SiStripClusterInfo::maxStrip(), TrackStruct::HitParameterStruct::maxStrip, TrackStruct::HitParameterStruct::maxStripInv, Topology::measurementPosition(), TrackStruct::negativeError, TrackStruct::HitParameterStruct::norResX, TrackStruct::HitParameterStruct::norResY, TrackStruct::notAssignedToSectors, TrackStruct::notInTracker, TrackStruct::HitParameterStruct::phiSens, TrackStruct::HitParameterStruct::phiSensX, TrackStruct::HitParameterStruct::phiSensY, align::Pixel, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, GloballyPositioned< T >::position(), positionAndError2(), LocalTrajectoryError::positionError(), funct::pow(), TrackStruct::HitParameterStruct::probX, TrackStruct::HitParameterStruct::probY, edm::ESHandle< class >::product(), TrackStruct::HitParameterStruct::projWidth, TrackStruct::HitParameterStruct::qBin, SiPixelRecHit::qBin(), DetId::rawId(), TrajectoryMeasurement::recHit(), TrackStruct::HitParameterStruct::resX, TrackStruct::HitParameterStruct::resY, SiStripClusterInfo::signalOverNoise(), SiPixelCluster::sizeX(), SiPixelCluster::sizeY(), TrackStruct::HitParameterStruct::sOverN, TrackStruct::HitParameterStruct::spansTwoRoc, SiPixelRecHit::spansTwoROCs(), GeomDet::specificSurface(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, align::Strip, SiStripClusterInfo::stripCharges(), GeomDet::surface(), StripSubdetector::TEC, Bounds::thickness(), StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, toLocal(), GeomDetType::topology(), DetId::Tracker, GeomDet::type(), TrackStruct::HitParameterStruct::v_sector, LocalError::valid(), SiStripClusterInfo::width(), Bounds::width(), TrackStruct::HitParameterStruct::widthX, TrackStruct::HitParameterStruct::widthY, PV2DBase< T, PVType, FrameType >::x(), SiPixelCluster::x(), TrackStruct::HitParameterStruct::xHit, TrackStruct::HitParameterStruct::xTrk, LocalError::xx(), LocalError::xy(), SiPixelCluster::y(), TrackStruct::HitParameterStruct::yHit, TrackStruct::HitParameterStruct::yTrk, and LocalError::yy().

Referenced by analyze().

1021  {
1022 
1023 
1025 
1026  static TrajectoryStateCombiner tsoscomb;
1027 
1028  const TrajectoryMeasurement& meas = i_meas;
1029  const TransientTrackingRecHit& hit = *meas.recHit();
1030  const TrackingRecHit& recHit = *hit.hit();
1031  const TrajectoryStateOnSurface& tsos = tsoscomb(meas.forwardPredictedState(),meas.backwardPredictedState());
1032 
1033  const DetId& detId(hit.geographicalId());
1034  const DetId::Detector& detector = detId.det(); if(detector != DetId::Tracker){hitParams.hitState = TrackStruct::notInTracker; return hitParams;}
1035  const uint32_t rawId(detId.rawId());
1036 
1037  for(std::map<unsigned int,TrackerSectorStruct>::const_iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
1038  for(std::vector<unsigned int>::const_iterator i_rawId = (*i_sector).second.v_rawId.begin();
1039  i_rawId != (*i_sector).second.v_rawId.end(); ++i_rawId){
1040  if(rawId==*i_rawId){hitParams.v_sector.push_back((*i_sector).first); break;}
1041  }
1042  }
1043 
1044  const align::LocalVector& mom(tsos.localDirection());
1045  int xMomentum(0), yMomentum(0), zMomentum(0);
1046  xMomentum = mom.x()>0. ? 1 : -1;
1047  yMomentum = mom.y()>0. ? 1 : -1;
1048  zMomentum = mom.z()>0. ? 1 : -1;
1049  float phiSensX = std::atan(std::fabs(mom.x()/mom.z()))*static_cast<float>(m_tkTreeVar_[rawId].vDirection); // check for orientation of E- and B- Field (thoughts for barrel)
1050  float phiSensY = std::atan(std::fabs(mom.y()/mom.z()))*static_cast<float>(m_tkTreeVar_[rawId].vDirection);
1051  hitParams.phiSens = std::atan(std::fabs(std::sqrt(mom.x()*mom.x()+mom.y()*mom.y())/mom.z()));
1052  hitParams.phiSensX = (xMomentum==zMomentum ? phiSensX : -phiSensX );
1053  hitParams.phiSensY = (yMomentum==zMomentum ? phiSensY : -phiSensY );
1054 
1055  if(!hit.isValid()){hitParams.hitState = TrackStruct::invalid; return hitParams;}
1056 
1057 
1058  // Get local positions and errors of hit and track
1059 
1060  const LocalPoint& lPHit = hit.localPosition();
1061  const LocalPoint& lPTrk = tsos.localPosition();
1062 
1063  // use APE also for the hit error, while APE is automatically included in tsos error
1064  //
1065  // no need to add APE to hitError anymore by Ajay 27 Oct 2014
1066 
1067 
1068  const LocalError& errHitApe = hit.localPositionError(); // now sum of CPE+APE as said by MARCO?
1069  LocalError errorWithoutAPE;
1070 
1071  bool Pixel(false);
1072  bool Strip(false);
1073 
1075  Pixel = true;
1076  }
1077  else if(m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB ||
1078  m_tkTreeVar_[rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TEC){
1079  Strip = true;
1080  }
1081  else { edm::LogWarning("FillHitVariables")<<"cant identify wether hit is from pixel or strip";
1082  hitParams.hitState = TrackStruct::invalid; return hitParams;}
1083 
1084 
1085  if(!hit.detUnit()){hitParams.hitState = TrackStruct::invalid; return hitParams;} // is it a single physical module?
1086  const GeomDetUnit& detUnit = *hit.detUnit();
1087 
1088 
1089  if(Pixel){
1090  if(!dynamic_cast<const PixelTopology*>(&detUnit.type().topology())){hitParams.hitState = TrackStruct::invalid; return hitParams;}
1091  const PixelGeomDetUnit * pixelDet = (const PixelGeomDetUnit*)(&detUnit);
1092  const LocalError& lape = pixelDet->localAlignmentError();
1093  if (lape.valid())
1094  { errorWithoutAPE = LocalError(errHitApe.xx() -lape.xx(), errHitApe.xy()- lape.xy(), errHitApe.yy()-lape.yy());
1095 
1096  }
1097  }
1098  if(Strip){
1099  if(!dynamic_cast<const StripTopology*>(&detUnit.type().topology())){hitParams.hitState = TrackStruct::invalid; return hitParams;}
1100  const StripGeomDetUnit * stripDet = (const StripGeomDetUnit*)(&detUnit);
1101  const LocalError& lape = stripDet->localAlignmentError();
1102  if (lape.valid())
1103  { errorWithoutAPE = LocalError(errHitApe.xx() -lape.xx(), errHitApe.xy()- lape.xy(), errHitApe.yy()-lape.yy());
1104  }
1105  }
1106 
1107 
1108  const LocalError& errHitWoApe = errorWithoutAPE;
1109  const LocalError& errTrk = tsos.localError().positionError();
1110 
1111  const StatePositionAndError2 positionAndError2Hit = this->positionAndError2(lPHit, errHitApe, hit);
1112  const StatePositionAndError2 positionAndError2HitWoApe = this->positionAndError2(lPHit, errHitWoApe, hit);
1113  std::cout<<"errHitWoApe " <<errHitWoApe<<"errHitApe "<<errHitApe<<std::endl;
1114 
1115  const StatePositionAndError2 positionAndError2Trk = this->positionAndError2(lPTrk, errTrk, hit);
1116 
1117  const TrackStruct::HitState& stateHit(positionAndError2Hit.first);
1118  const TrackStruct::HitState& stateHitWoApe(positionAndError2HitWoApe.first);
1119  const TrackStruct::HitState& stateTrk(positionAndError2Trk.first);
1120 
1121  if(stateHit==TrackStruct::invalid || stateHitWoApe==TrackStruct::invalid || stateTrk==TrackStruct::invalid){
1122  hitParams.hitState = TrackStruct::invalid;
1123  return hitParams;
1124  }
1125  else if(stateHit==TrackStruct::negativeError || stateHitWoApe==TrackStruct::negativeError || stateTrk==TrackStruct::negativeError){
1126  ++counter1;
1127  // Do not print error message by default
1128  //std::stringstream ss_error;
1129  //ss_error<<"Upper values belong to: ";
1130  //if(stateHit==TrackStruct::negativeError)ss_error<<"Hit without APE, ";
1131  //if(stateHitWoApe==TrackStruct::negativeError)ss_error<<"Hit with APE, ";
1132  //if(stateTrk==TrackStruct::negativeError)ss_error<<"Track,";
1133  //edm::LogError("Negative error Value")<<"@SUB=ApeEstimator::fillHitVariables"<<ss_error.str();
1135  return hitParams;
1136  }
1137 
1138 
1139  // Calculate residuals
1140 
1141  const float xHit = positionAndError2Hit.second.posX;
1142  const float xTrk = positionAndError2Trk.second.posX;
1143  const float yHit = positionAndError2Hit.second.posY;
1144  const float yTrk = positionAndError2Trk.second.posY;
1145 
1146  const float errXHit2(positionAndError2Hit.second.errX2);
1147  const float errXHitWoApe2(positionAndError2HitWoApe.second.errX2);
1148  const float errXTrk2(positionAndError2Trk.second.errX2);
1149  const float errYHit2(positionAndError2Hit.second.errY2);
1150  const float errYHitWoApe2(positionAndError2HitWoApe.second.errY2);
1151  const float errYTrk2(positionAndError2Trk.second.errY2);
1152 
1153  const float errXHit = std::sqrt(positionAndError2Hit.second.errX2);
1154  const float errXHitWoApe = std::sqrt(positionAndError2HitWoApe.second.errX2);
1155  const float errXTrk = std::sqrt(positionAndError2Trk.second.errX2);
1156  const float errYHit = std::sqrt(positionAndError2Hit.second.errY2);
1157  const float errYHitWoApe = std::sqrt(positionAndError2HitWoApe.second.errY2);
1158  const float errYTrk = std::sqrt(positionAndError2Trk.second.errY2);
1159 
1160  const float resX = xTrk - xHit;
1161  const float resY = yTrk - yHit;
1162 
1163  const float errX = std::sqrt(errXHit2 + errXTrk2);
1164  const float errXWoApe2 = errXHitWoApe2 + errXTrk2;
1165  const float errXWoApe = std::sqrt(errXWoApe2);
1166  const float errY = std::sqrt(errYHit2 + errYTrk2);
1167  const float errYWoApe2 = errYHitWoApe2 + errYTrk2;
1168  const float errYWoApe = std::sqrt(errYWoApe2);
1169 
1170  const float norResX = resX/errX;
1171  const float norResY = resY/errY;
1172 
1173 
1174 
1175  // Take global orientation into account for residuals (sign is not important for errors)
1176 
1177  float resXprime(999.F), resYprime(999.F), norResXprime(999.F), norResYprime(999.F);
1178  if(m_tkTreeVar_[rawId].uDirection == 1){resXprime = resX; norResXprime = norResX;}
1179  else if(m_tkTreeVar_[rawId].uDirection == -1){resXprime = -resX; norResXprime = -norResX;}
1180  else {edm::LogError("FillHitVariables")<<"Incorrect value of uDirection, which gives global module orientation"; hitParams.hitState = TrackStruct::invalid; return hitParams;}
1181  if(m_tkTreeVar_[rawId].vDirection == 1){resYprime = resY; norResYprime = norResY;}
1182  else if(m_tkTreeVar_[rawId].vDirection == -1){resYprime = -resY; norResYprime = -norResY;}
1183  else {edm::LogError("FillHitVariables")<<"Incorrect value of vDirection, which gives global module orientation"; hitParams.hitState = TrackStruct::invalid; return hitParams;}
1184 
1185  hitParams.xHit = xHit;
1186  hitParams.xTrk = xTrk;
1187 
1188  hitParams.errXHit = errXHit;
1189  hitParams.errXHitWoApe = errXHitWoApe;
1190  hitParams.errXTrk = errXTrk;
1191 
1192  hitParams.errX2 = errX*errX;
1193  hitParams.errX = errX;
1194  hitParams.errXWoApe = errXWoApe;
1195 
1196  hitParams.resX = resXprime;
1197  hitParams.norResX = norResXprime;
1198 
1199  const float norResX2(norResXprime*norResXprime);
1200  hitParams.probX = TMath::Prob(norResX2,1);
1201 
1202 
1203  hitParams.yHit = yHit;
1204  hitParams.yTrk = yTrk;
1205 
1206  hitParams.errYHit = errYHit;
1207  hitParams.errYHitWoApe = errYHitWoApe;
1208  hitParams.errYTrk = errYTrk;
1209 
1210  hitParams.errY2 = errY*errY;
1211  hitParams.errY = errY;
1212  hitParams.errYWoApe = errYWoApe;
1213 
1214  hitParams.resY = resYprime;
1215  hitParams.norResY = norResYprime;
1216 
1217  const float norResY2(norResYprime*norResYprime);
1218  hitParams.probY = TMath::Prob(norResY2,1);
1219 
1220 
1221  // Cluster parameters
1222 
1224  const SiPixelRecHit& pixelHit = dynamic_cast<const SiPixelRecHit&>(recHit);
1225  const SiPixelCluster& pixelCluster = *pixelHit.cluster();
1226 
1227  hitParams.chargePixel = pixelCluster.charge();
1228  hitParams.widthX = pixelCluster.sizeX();
1229  hitParams.baryStripX = pixelCluster.x();
1230  hitParams.widthY = pixelCluster.sizeY();
1231  hitParams.baryStripY = pixelCluster.y();
1232 
1233  hitParams.clusterProbabilityXY = pixelHit.clusterProbability(0);
1234  hitParams.clusterProbabilityQ = pixelHit.clusterProbability(2);
1235  hitParams.clusterProbabilityXYQ = pixelHit.clusterProbability(1);
1236  hitParams.logClusterProbability = std::log10(hitParams.clusterProbabilityXY);
1237 
1238  hitParams.isOnEdge = pixelHit.isOnEdge();
1239  hitParams.hasBadPixels = pixelHit.hasBadPixels();
1240  hitParams.spansTwoRoc = pixelHit.spansTwoROCs();
1241  hitParams.qBin = pixelHit.qBin();
1242 
1243  hitParams.isPixelHit = true;
1244  }
1245  else if(m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB ||
1246  m_tkTreeVar_[rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TEC){
1247  if(!(dynamic_cast<const SiStripRecHit2D*>(&recHit) || dynamic_cast<const SiStripRecHit1D*>(&recHit))){
1248  edm::LogError("FillHitVariables")<<"RecHit in Strip is 'Matched' or 'Projected', but here all should be monohits per module";
1249  hitParams.hitState = TrackStruct::invalid; return hitParams;
1250  }
1251  const SiStripCluster* clusterPtr(0);
1252  if(m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB){
1253  if(dynamic_cast<const SiStripRecHit1D*>(&recHit)){
1254  const SiStripRecHit1D& stripHit = dynamic_cast<const SiStripRecHit1D&>(recHit);
1255  clusterPtr = &(*stripHit.cluster());
1256  }
1257  else if(dynamic_cast<const SiStripRecHit2D*>(&recHit)){
1258  edm::LogWarning("FillHitVariables")<<"Data has TIB/TOB hits as SiStripRecHit2D and not 1D. Probably data is processed with CMSSW<34X. Nevertheless everything should work fine";
1259  const SiStripRecHit2D& stripHit = dynamic_cast<const SiStripRecHit2D&>(recHit);
1260  clusterPtr = &(*stripHit.cluster());
1261  }
1262  }
1263  else if(m_tkTreeVar_[rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TEC){
1264  const SiStripRecHit2D& stripHit = dynamic_cast<const SiStripRecHit2D&>(recHit);
1265  clusterPtr = &(*stripHit.cluster());
1266  }
1267  if(!clusterPtr){
1268  edm::LogError("FillHitVariables")<<"Pointer to cluster not valid!!! This should never happen...";
1269  hitParams.hitState = TrackStruct::invalid; return hitParams;
1270  }
1271  const SiStripCluster& stripCluster(*clusterPtr);
1272 
1273  const SiStripClusterInfo clusterInfo =SiStripClusterInfo(stripCluster,iSetup,rawId,std::string(""));
1274 
1275  const std::vector<uint8_t>::const_iterator stripChargeL(clusterInfo.stripCharges().begin());
1276  const std::vector<uint8_t>::const_iterator stripChargeR(--(clusterInfo.stripCharges().end()));
1277  const std::pair<uint16_t, uint16_t> stripChargeLR = std::make_pair(*stripChargeL,*stripChargeR);
1278 
1279  hitParams.chargeStrip = clusterInfo.charge();
1280  hitParams.widthX = clusterInfo.width();
1281  hitParams.baryStripX = clusterInfo.baryStrip() +1.;
1282  hitParams.isModuleUsable = clusterInfo.IsModuleUsable();
1283  hitParams.maxStrip = clusterInfo.maxStrip() +1;
1284  hitParams.maxStripInv = m_tkTreeVar_[rawId].nStrips - hitParams.maxStrip +1;
1285  hitParams.maxCharge = clusterInfo.maxCharge();
1286  hitParams.maxIndex = clusterInfo.maxIndex();
1287  hitParams.chargeOnEdges = static_cast<float>(stripChargeLR.first + stripChargeLR.second)/static_cast<float>(hitParams.chargeStrip);
1288  hitParams.chargeAsymmetry = static_cast<float>(stripChargeLR.first - stripChargeLR.second)/static_cast<float>(stripChargeLR.first + stripChargeLR.second);
1289  hitParams.chargeLRplus = static_cast<float>(clusterInfo.chargeLR().first + clusterInfo.chargeLR().second)/static_cast<float>(hitParams.chargeStrip);
1290  hitParams.chargeLRminus = static_cast<float>(clusterInfo.chargeLR().first - clusterInfo.chargeLR().second)/static_cast<float>(hitParams.chargeStrip);
1291  hitParams.sOverN = clusterInfo.signalOverNoise();
1292 
1293 
1294  // Calculate projection length corrected by drift
1295  if(!hit.detUnit()){hitParams.hitState = TrackStruct::invalid; return hitParams;} // is it a single physical module?
1296  const GeomDetUnit& detUnit = *hit.detUnit();
1297  if(!dynamic_cast<const StripTopology*>(&detUnit.type().topology())){hitParams.hitState = TrackStruct::invalid; return hitParams;}
1298 
1299 
1300  edm::ESHandle<MagneticField> magFieldHandle;
1301  iSetup.get<IdealMagneticFieldRecord>().get(magFieldHandle);
1302 
1303  edm::ESHandle<SiStripLorentzAngle> lorentzAngleHandle;
1304  iSetup.get<SiStripLorentzAngleDepRcd>().get(lorentzAngleHandle); //MODIFIED BY LOIC QUERTENMONT
1305 
1306 
1307  const StripGeomDetUnit * stripDet = (const StripGeomDetUnit*)(&detUnit);
1308  const MagneticField * magField(magFieldHandle.product());
1309  LocalVector bField = (stripDet->surface()).toLocal(magField->inTesla(stripDet->surface().position()));
1310  const SiStripLorentzAngle * lorentzAngle(lorentzAngleHandle.product());
1311  float tanLorentzAnglePerTesla = lorentzAngle->getLorentzAngle(stripDet->geographicalId().rawId());
1312 
1313  float dirX = -tanLorentzAnglePerTesla * bField.y();
1314  float dirY = tanLorentzAnglePerTesla * bField.x();
1315  float dirZ = 1.; // E field always in z direction
1316  LocalVector driftDirection(dirX,dirY,dirZ);
1317 
1318 
1319  const Bounds& bounds = stripDet->specificSurface().bounds();
1320  float maxLength = std::sqrt(std::pow(bounds.length(),2)+std::pow(bounds.width(),2));
1321  float thickness = bounds.thickness();
1322 
1323 
1324 
1325  const StripTopology& topol = dynamic_cast<const StripTopology&>(detUnit.type().topology());
1326  LocalVector momentumDir(tsos.localDirection());
1327  LocalPoint momentumPos(tsos.localPosition());
1328  LocalVector scaledMomentumDir(momentumDir);
1329  if(momentumDir.z() > 0.)scaledMomentumDir *= std::fabs(thickness/momentumDir.z());
1330  else if(momentumDir.z() < 0.)scaledMomentumDir *= -std::fabs(thickness/momentumDir.z());
1331  else scaledMomentumDir *= maxLength/momentumDir.mag();
1332 
1333  float projEdge1 = topol.measurementPosition(momentumPos - 0.5*scaledMomentumDir).x();
1334  if(projEdge1 < 0.)projEdge1 = 0.;
1335  else if(projEdge1 > m_tkTreeVar_[rawId].nStrips)projEdge1 = m_tkTreeVar_[rawId].nStrips;
1336  float projEdge2 = topol.measurementPosition(momentumPos + 0.5*scaledMomentumDir).x();
1337  if(projEdge2 < 0.)projEdge1 = 0.;
1338  else if(projEdge2 > m_tkTreeVar_[rawId].nStrips)projEdge1 = m_tkTreeVar_[rawId].nStrips;
1339 
1340 
1341  float coveredStrips = std::fabs(projEdge2 - projEdge1);
1342 
1343  hitParams.projWidth = coveredStrips;
1344 
1345 
1346 
1347 
1348  }
1349  else{
1350  edm::LogError("FillHitVariables")<<"Incorrect subdetector ID, hit not associated to tracker";
1351  hitParams.hitState = TrackStruct::notInTracker; return hitParams;
1352  }
1353 
1354 
1355  if(!hitParams.isModuleUsable){hitParams.hitState = TrackStruct::invalid; return hitParams;}
1356 
1357  if(0==hitParams.v_sector.size()){hitParams.hitState = TrackStruct::notAssignedToSectors; return hitParams;}
1358 
1359  return hitParams;
1360 //}
1361 }
ClusterRef cluster() const
uint8_t maxCharge() const
bool valid() const
Definition: LocalError.h:21
std::vector< unsigned int > v_sector
float charge() const
float xx() const
Definition: LocalError.h:24
float clusterProbability(unsigned int flags=0) const
virtual float length() const =0
ConstRecHitPointer const & recHit() const
virtual const GeomDetType & type() const
Definition: GeomDet.cc:90
std::pair< uint16_t, uint16_t > chargeLR() const
LocalVector localDirection() const
unsigned int counter1
float baryStrip() const
const Bounds & bounds() const
Definition: Surface.h:128
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
uint16_t maxIndex() const
bool isOnEdge() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
LocalError positionError() const
bool hasBadPixels() const
std::pair< TrackStruct::HitState, PositionAndError2 > StatePositionAndError2
auto stripCharges() const -> decltype(cluster() ->amplitudes())
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual float thickness() const =0
float signalOverNoise() const
float xy() const
Definition: LocalError.h:25
float getLorentzAngle(const uint32_t &) const
uint16_t charge() const
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
uint16_t width() const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
ClusterRef cluster() const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
const LocalTrajectoryError & localError() const
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
int qBin() const
Definition: DetId.h:18
virtual TrackingRecHit const * hit() const
uint16_t maxStrip() const
virtual LocalError localPositionError() const =0
Detector
Definition: DetId.h:24
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
bool isValid() const
virtual const Topology & topology() const =0
int sizeY() const
bool IsModuleUsable() const
std::map< unsigned int, ReducedTrackerTreeVariables > m_tkTreeVar_
Pixel cluster – collection of neighboring pixels above threshold.
virtual const GeomDetUnit * detUnit() const
bool spansTwoROCs() const
float y() const
tuple cout
Definition: gather_cfg.py:121
Definition: Bounds.h:22
DetId geographicalId() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
T x() const
Definition: PV2DBase.h:45
int sizeX() const
virtual LocalPoint localPosition() const =0
virtual float width() const =0
const PositionType & position() const
float x() const
LocalError const & localAlignmentError() const
Return local alligment error.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:43
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Our base class.
Definition: SiPixelRecHit.h:23
StatePositionAndError2 positionAndError2(const LocalPoint &, const LocalError &, const TransientTrackingRecHit &)
TrackStruct::TrackParameterStruct ApeEstimator::fillTrackVariables ( const reco::Track track,
const Trajectory traj,
const reco::BeamSpot beamSpot 
)
private

Definition at line 947 of file ApeEstimator.cc.

References funct::abs(), TrajectoryMeasurement::backwardPredictedState(), reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), reco::TrackBase::charge(), reco::TrackBase::chi2(), reco::TrackBase::d0(), reco::TrackBase::d0Error(), reco::TrackBase::dxy(), reco::TrackBase::dz(), reco::TrackBase::dzError(), reco::TrackBase::eta(), reco::TrackBase::etaError(), F(), TrajectoryMeasurement::forwardPredictedState(), reco::Track::found(), edm::ParameterSet::getParameter(), TrackingRecHit::hit(), reco::TrackBase::hitPattern(), TrackStruct::TrackParameterStruct::hitsSize, isHit2D(), TrajectoryStateOnSurface::localDirection(), reco::Track::lost(), Trajectory::measurements(), reco::TrackBase::ndof(), reco::TrackBase::p(), parameterSet_, reco::TrackBase::phi(), reco::TrackBase::phiError(), reco::TrackBase::pt(), reco::TrackBase::ptError(), TrajectoryMeasurement::recHit(), reco::Track::recHitsSize(), mathSSE::sqrt(), reco::TrackBase::theta(), trackCut_, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

Referenced by analyze().

947  {
948 
949  const math::XYZPoint beamPoint(beamSpot.x0(),beamSpot.y0(), beamSpot.z0());
950  double d0BeamspotErr = std::sqrt( track.d0Error()*track.d0Error() + 0.5*beamSpot.BeamWidthX()*beamSpot.BeamWidthX() + 0.5*beamSpot.BeamWidthY()*beamSpot.BeamWidthY() );
951 
952  static TrajectoryStateCombiner tsoscomb;
953 
954  const reco::HitPattern& hitPattern(track.hitPattern());
955 
957 
958  trkParams.hitsSize = track.recHitsSize();
959  trkParams.hitsValid = track.found(); // invalid is every hit from every single module that expects a hit
960  trkParams.hitsInvalid = trkParams.hitsSize-trkParams.hitsValid;
961  trkParams.layersMissed = track.lost(); // lost hit means, that a crossed layer doesn't contain a hit (can be more than one invalid hit)
962  trkParams.hitsPixel = hitPattern.numberOfValidPixelHits();
963  trkParams.hitsStrip = hitPattern.numberOfValidStripHits();
964  trkParams.charge = track.charge();
965  trkParams.chi2 = track.chi2();
966  trkParams.ndof = track.ndof();
967  trkParams.norChi2 = trkParams.chi2/trkParams.ndof;
968  trkParams.prob = TMath::Prob(trkParams.chi2,trkParams.ndof);
969  trkParams.eta = track.eta();
970  trkParams.etaErr = track.etaError();
971  trkParams.theta = track.theta();
972  trkParams.phi = track.phi();
973  trkParams.phiErr = track.phiError();
974  trkParams.d0 = track.d0();
975  trkParams.d0Beamspot = -1.*track.dxy(beamPoint);
976  trkParams.d0BeamspotErr = d0BeamspotErr;
977  trkParams.dz = track.dz();
978  trkParams.dzErr = track.dzError();
979  trkParams.dzBeamspot = track.dz(beamPoint);
980  trkParams.p = track.p();
981  trkParams.pt = track.pt();
982  trkParams.ptErr = track.ptError();
983 
984  const std::vector<TrajectoryMeasurement>& v_meas = traj.measurements();
985 
986  int count2D(0); float meanPhiSensToNorm(0.F);
987  std::vector<TrajectoryMeasurement>::const_iterator i_meas;
988  for(i_meas = v_meas.begin(); i_meas != v_meas.end(); ++i_meas){
989  const TrajectoryMeasurement& meas = *i_meas;
990  const TransientTrackingRecHit& hit = *meas.recHit();
991  const TrackingRecHit& recHit = *hit.hit();
992  if(this->isHit2D(recHit))++count2D;
993 
995  const align::LocalVector mom(tsos.localDirection());
996  meanPhiSensToNorm += atan(fabs(sqrt(mom.x()*mom.x()+mom.y()*mom.y())/mom.z()));
997  }
998  meanPhiSensToNorm *= (1./static_cast<float>(trkParams.hitsSize));
999 
1000  trkParams.hits2D = count2D;
1001  trkParams.meanPhiSensToNorm = meanPhiSensToNorm;
1002 
1003  if(parameterSet_.getParameter<bool>("applyTrackCuts")){
1004  trackCut_ = false;
1005  if(trkParams.hitsStrip<11 || trkParams.hits2D<2 || trkParams.hitsPixel<2 || //trkParams.hitsInvalid>2 ||
1006  trkParams.hitsStrip>35 || trkParams.hitsPixel>7 ||
1007  trkParams.norChi2>5. ||
1008  trkParams.pt<25. || trkParams.pt>150. ||
1009  std::abs(trkParams.d0Beamspot)>0.02 || std::abs(trkParams.dz)>15.)trackCut_ = true;
1010  }
1011  else{
1012  trackCut_ = false;
1013  }
1014 
1015  return trkParams;
1016 }
double p() const
momentum vector magnitude
Definition: TrackBase.h:578
T getParameter(std::string const &) const
double z0() const
z coordinate
Definition: BeamSpot.h:68
const edm::ParameterSet parameterSet_
double d0Error() const
error on d0
Definition: TrackBase.h:765
unsigned short lost() const
Number of lost (=invalid) hits on track.
Definition: Track.h:199
ConstRecHitPointer const & recHit() const
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:560
double theta() const
polar angle
Definition: TrackBase.h:542
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:119
LocalVector localDirection() const
double etaError() const
error on eta
Definition: TrackBase.h:747
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:608
DataContainer const & measurements() const
Definition: Trajectory.h:203
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:614
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:512
double ndof() const
number of degrees of freedom of the fit
Definition: TrackBase.h:518
T sqrt(T t)
Definition: SSEVec.h:48
bool isHit2D(const TrackingRecHit &) const
double pt() const
track transverse momentum
Definition: TrackBase.h:584
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
Definition: TrackBase.h:726
double phiError() const
error on phi
Definition: TrackBase.h:753
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:572
double dzError() const
error on dz
Definition: TrackBase.h:777
virtual TrackingRecHit const * hit() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:421
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:88
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:194
double y0() const
y coordinate
Definition: BeamSpot.h:66
int charge() const
track electric charge
Definition: TrackBase.h:530
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:554
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
double x0() const
x coordinate
Definition: BeamSpot.h:64
bool ApeEstimator::hitSelected ( TrackStruct::HitParameterStruct hitParams) const
private

Definition at line 1623 of file ApeEstimator.cc.

References TrackStruct::HitParameterStruct::baryStripX, TrackStruct::HitParameterStruct::baryStripY, TrackStruct::HitParameterStruct::chargeAsymmetry, TrackStruct::HitParameterStruct::chargeLRminus, TrackStruct::HitParameterStruct::chargeLRplus, TrackStruct::HitParameterStruct::chargeOnEdges, TrackStruct::HitParameterStruct::chargePixel, TrackStruct::HitParameterStruct::chargeStrip, TrackStruct::HitParameterStruct::clusterProbabilityQ, TrackStruct::HitParameterStruct::clusterProbabilityXY, TrackStruct::HitParameterStruct::clusterProbabilityXYQ, TrackStruct::HitParameterStruct::errX, TrackStruct::HitParameterStruct::errX2, TrackStruct::HitParameterStruct::errXHit, TrackStruct::HitParameterStruct::errXTrk, TrackStruct::HitParameterStruct::errY, TrackStruct::HitParameterStruct::errY2, TrackStruct::HitParameterStruct::errYHit, TrackStruct::HitParameterStruct::errYTrk, TrackStruct::HitParameterStruct::goodXMeasurement, TrackStruct::HitParameterStruct::goodYMeasurement, TrackStruct::HitParameterStruct::hasBadPixels, hitSelection(), TrackStruct::HitParameterStruct::hitState, inDoubleInterval(), inUintInterval(), TrackStruct::invalid, TrackStruct::HitParameterStruct::isOnEdge, TrackStruct::HitParameterStruct::isPixelHit, TrackStruct::HitParameterStruct::logClusterProbability, m_hitSelection_, m_hitSelectionUInt_, python.multivaluedict::map(), TrackStruct::HitParameterStruct::maxCharge, TrackStruct::HitParameterStruct::maxIndex, TrackStruct::HitParameterStruct::maxStrip, TrackStruct::HitParameterStruct::maxStripInv, TrackStruct::negativeError, TrackStruct::HitParameterStruct::norResX, TrackStruct::HitParameterStruct::norResY, TrackStruct::notInTracker, TrackStruct::HitParameterStruct::phiSens, TrackStruct::HitParameterStruct::phiSensX, TrackStruct::HitParameterStruct::phiSensY, TrackStruct::HitParameterStruct::probX, TrackStruct::HitParameterStruct::probY, TrackStruct::HitParameterStruct::projWidth, TrackStruct::HitParameterStruct::qBin, TrackStruct::HitParameterStruct::resX, TrackStruct::HitParameterStruct::resY, TrackStruct::HitParameterStruct::sOverN, TrackStruct::HitParameterStruct::spansTwoRoc, AlCaHLTBitMon_QueryRunRegistry::string, TrackStruct::HitParameterStruct::widthX, and TrackStruct::HitParameterStruct::widthY.

Referenced by analyze().

1623  {
1624  if(hitParams.hitState == TrackStruct::notInTracker)return false;
1625  if(hitParams.hitState == TrackStruct::invalid || hitParams.hitState == TrackStruct::negativeError)return false;
1626 
1627  bool isGoodHit(true);
1628  bool isGoodHitX(true);
1629  bool isGoodHitY(true);
1630 
1631  for(std::map<std::string, std::vector<double> >::const_iterator i_hitSelection = m_hitSelection_.begin(); i_hitSelection != m_hitSelection_.end(); ++i_hitSelection){
1632  const std::string& hitSelection((*i_hitSelection).first);
1633  const std::vector<double>& v_hitSelection((*i_hitSelection).second);
1634  if(v_hitSelection.size()==0)continue;
1635 
1636  // For pixel and strip sectors in common
1637  if (hitSelection == "phiSens") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSens))isGoodHit = false;}
1638  else if(hitSelection == "phiSensX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSensX))isGoodHit = false;}
1639  else if(hitSelection == "phiSensY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSensY))isGoodHit = false;}
1640 
1641  else if(hitSelection == "resX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.resX))isGoodHitX = false;}
1642  else if(hitSelection == "norResX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.norResX))isGoodHitX = false;}
1643  else if(hitSelection == "probX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.probX))isGoodHitX = false;}
1644  else if(hitSelection == "errXHit") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errXHit))isGoodHitX = false;}
1645  else if(hitSelection == "errXTrk") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errXTrk))isGoodHitX = false;}
1646  else if(hitSelection == "errX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errX))isGoodHitX = false;}
1647  else if(hitSelection == "errX2") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errX2))isGoodHitX = false;}
1648 
1649  // For pixel only
1650  if(hitParams.isPixelHit){
1651  if (hitSelection == "chargePixel") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargePixel))isGoodHit = false;}
1652  else if(hitSelection == "clusterProbabilityXY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.clusterProbabilityXY))isGoodHit = false;}
1653  else if(hitSelection == "clusterProbabilityQ") {if(!this->inDoubleInterval(v_hitSelection, hitParams.clusterProbabilityQ))isGoodHit = false;}
1654  else if(hitSelection == "clusterProbabilityXYQ"){if(!this->inDoubleInterval(v_hitSelection, hitParams.clusterProbabilityXYQ))isGoodHit = false;}
1655  else if(hitSelection == "logClusterProbability"){if(!this->inDoubleInterval(v_hitSelection, hitParams.logClusterProbability))isGoodHit = false;}
1656 
1657  else if(hitSelection == "baryStripX") {if(!this->inDoubleInterval(v_hitSelection, hitParams.baryStripX))isGoodHitX = false;}
1658  else if(hitSelection == "baryStripY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.baryStripY))isGoodHitY = false;}
1659 
1660 
1661 
1662  else if(hitSelection == "resY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.resY))isGoodHitY = false;}
1663  else if(hitSelection == "norResY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.norResY))isGoodHitY = false;}
1664  else if(hitSelection == "probY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.probY))isGoodHitY = false;}
1665  else if(hitSelection == "errYHit") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errYHit))isGoodHitY = false;}
1666  else if(hitSelection == "errYTrk") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errYTrk))isGoodHitY = false;}
1667  else if(hitSelection == "errY") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errY))isGoodHitY = false;}
1668  else if(hitSelection == "errY2") {if(!this->inDoubleInterval(v_hitSelection, hitParams.errY2))isGoodHitY = false;}
1669  }
1670 
1671  // For strip only
1672  else{
1673  if (hitSelection == "widthProj") {if(!this->inDoubleInterval(v_hitSelection, hitParams.projWidth))isGoodHit = false;}
1674  else if(hitSelection == "widthDiff") {if(!this->inDoubleInterval(v_hitSelection, hitParams.projWidth-static_cast<float>(hitParams.widthX)))isGoodHit = false;}
1675  else if(hitSelection == "charge") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeStrip))isGoodHit = false;}
1676  else if(hitSelection == "maxCharge") {if(!this->inDoubleInterval(v_hitSelection, hitParams.maxCharge))isGoodHit = false;}
1677  else if(hitSelection == "chargeOnEdges") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeOnEdges))isGoodHit = false;}
1678  else if(hitSelection == "chargeAsymmetry"){if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeAsymmetry))isGoodHit = false;}
1679  else if(hitSelection == "chargeLRplus") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeLRplus))isGoodHit = false;}
1680  else if(hitSelection == "chargeLRminus") {if(!this->inDoubleInterval(v_hitSelection, hitParams.chargeLRminus))isGoodHit = false;}
1681  else if(hitSelection == "sOverN") {if(!this->inDoubleInterval(v_hitSelection, hitParams.sOverN))isGoodHit = false;}
1682  }
1683  }
1684 
1685  for(std::map<std::string, std::vector<unsigned int> >::const_iterator i_hitSelection = m_hitSelectionUInt_.begin(); i_hitSelection != m_hitSelectionUInt_.end(); ++i_hitSelection){
1686  const std::string& hitSelection((*i_hitSelection).first);
1687  const std::vector<unsigned int>& v_hitSelection((*i_hitSelection).second);
1688  if(v_hitSelection.size()==0)continue;
1689 
1690  // For pixel and strip sectors in common
1691 
1692  // For pixel only
1693  if(hitParams.isPixelHit){
1694  if(hitSelection == "isOnEdge") {if(!this->inUintInterval(v_hitSelection, hitParams.isOnEdge))isGoodHit = false;}
1695  else if(hitSelection == "hasBadPixels"){if(!this->inUintInterval(v_hitSelection, hitParams.hasBadPixels))isGoodHit = false;}
1696  else if(hitSelection == "spansTwoRoc") {if(!this->inUintInterval(v_hitSelection, hitParams.spansTwoRoc))isGoodHit = false;}
1697  else if(hitSelection == "qBin") {if(!this->inUintInterval(v_hitSelection, hitParams.qBin))isGoodHit = false;}
1698 
1699  else if(hitSelection == "widthX") {if(!this->inUintInterval(v_hitSelection, hitParams.widthX))isGoodHitX = false;}
1700  else if(hitSelection == "widthY") {if(!this->inUintInterval(v_hitSelection, hitParams.widthY))isGoodHitY = false;}
1701  }
1702 
1703  // For strip only
1704  else{
1705  if (hitSelection == "width") {if(!this->inUintInterval(v_hitSelection, hitParams.widthX))isGoodHit = false;}
1706  else if(hitSelection == "edgeStrips"){if(!this->inUintInterval(v_hitSelection, hitParams.maxStrip, hitParams.maxStripInv))isGoodHit = false;}
1707  else if(hitSelection == "maxIndex") {if(!this->inUintInterval(v_hitSelection, hitParams.maxIndex))isGoodHit = false;}
1708  }
1709  }
1710 
1711  if(hitParams.isPixelHit){
1712  hitParams.goodXMeasurement = isGoodHit && isGoodHitX;
1713  hitParams.goodYMeasurement = isGoodHit && isGoodHitY;
1714  }
1715  else{
1716  hitParams.goodXMeasurement = isGoodHit && isGoodHitX;
1717  hitParams.goodYMeasurement = false;
1718  }
1719 
1720  if(!hitParams.goodXMeasurement && !hitParams.goodYMeasurement)return false;
1721  else return true;
1722 }
bool inDoubleInterval(const std::vector< double > &, const float) const
void hitSelection()
std::map< std::string, std::vector< unsigned int > > m_hitSelectionUInt_
bool inUintInterval(const std::vector< unsigned int > &, const unsigned int, const unsigned int=999) const
std::map< std::string, std::vector< double > > m_hitSelection_
void ApeEstimator::hitSelection ( )
private

Definition at line 1482 of file ApeEstimator.cc.

References m_hitSelection_, m_hitSelectionUInt_, python.multivaluedict::map(), setHitSelectionMap(), setHitSelectionMapUInt(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by beginJob(), and hitSelected().

1482  {
1483  this->setHitSelectionMapUInt("width");
1484  this->setHitSelectionMap("widthProj");
1485  this->setHitSelectionMap("widthDiff");
1486  this->setHitSelectionMap("charge");
1487  this->setHitSelectionMapUInt("edgeStrips");
1488  this->setHitSelectionMap("maxCharge");
1489  this->setHitSelectionMapUInt("maxIndex");
1490  this->setHitSelectionMap("chargeOnEdges");
1491  this->setHitSelectionMap("chargeAsymmetry");
1492  this->setHitSelectionMap("chargeLRplus");
1493  this->setHitSelectionMap("chargeLRminus");
1494  this->setHitSelectionMap("sOverN");
1495 
1496  this->setHitSelectionMap("chargePixel");
1497  this->setHitSelectionMapUInt("widthX");
1498  this->setHitSelectionMapUInt("widthY");
1499 
1500 
1501  this->setHitSelectionMap("baryStripX");
1502  this->setHitSelectionMap("baryStripY");
1503  this->setHitSelectionMap("clusterProbabilityXY");
1504  this->setHitSelectionMap("clusterProbabilityQ");
1505  this->setHitSelectionMap("clusterProbabilityXYQ");
1506  this->setHitSelectionMap("logClusterProbability");
1507  this->setHitSelectionMapUInt("isOnEdge");
1508  this->setHitSelectionMapUInt("hasBadPixels");
1509  this->setHitSelectionMapUInt("spansTwoRoc");
1510  this->setHitSelectionMapUInt("qBin");
1511 
1512 
1513 
1514  this->setHitSelectionMap("phiSens");
1515  this->setHitSelectionMap("phiSensX");
1516  this->setHitSelectionMap("phiSensY");
1517  this->setHitSelectionMap("resX");
1518  this->setHitSelectionMap("norResX");
1519  this->setHitSelectionMap("probX");
1520  this->setHitSelectionMap("errXHit");
1521  this->setHitSelectionMap("errXTrk");
1522  this->setHitSelectionMap("errX");
1523  this->setHitSelectionMap("errX2");
1524 
1525  this->setHitSelectionMap("resY");
1526  this->setHitSelectionMap("norResY");
1527  this->setHitSelectionMap("probY");
1528  this->setHitSelectionMap("errYHit");
1529  this->setHitSelectionMap("errYTrk");
1530  this->setHitSelectionMap("errY");
1531  this->setHitSelectionMap("errY2");
1532 
1533  edm::LogInfo("HitSelector")<<"applying hit cuts ...";
1534  bool emptyMap(true);
1535  for(std::map<std::string, std::vector<double> >::iterator i_hitSelection = m_hitSelection_.begin(); i_hitSelection != m_hitSelection_.end(); ++i_hitSelection){
1536  if(0 < (*i_hitSelection).second.size()){
1537  int entry(1); double intervalBegin(999.);
1538  for(std::vector<double>::iterator i_hitInterval = (*i_hitSelection).second.begin(); i_hitInterval != (*i_hitSelection).second.end(); ++entry){
1539  if(entry%2==1){intervalBegin = *i_hitInterval; ++i_hitInterval;}
1540  else{
1541  if(intervalBegin > *i_hitInterval){
1542  edm::LogError("HitSelector")<<"INVALID Interval selected for "<<(*i_hitSelection).first<<":\t"<<intervalBegin<<" > "<<(*i_hitInterval)
1543  <<"\n ... delete Selection for "<<(*i_hitSelection).first;
1544  (*i_hitSelection).second.clear(); i_hitInterval = (*i_hitSelection).second.begin(); //emptyMap = true; i_hitSelection = m_hitSelection_.begin();
1545  }else{
1546  edm::LogInfo("HitSelector")<<"Interval selected for "<<(*i_hitSelection).first<<":\t"<<intervalBegin<<", "<<(*i_hitInterval);
1547  ++i_hitInterval;
1548  }
1549  }
1550  }
1551  if(0 < (*i_hitSelection).second.size())emptyMap = false;
1552  }
1553  }
1554 
1555 
1556  bool emptyMapUInt(true);
1557  for(std::map<std::string, std::vector<unsigned int> >::iterator i_hitSelection = m_hitSelectionUInt_.begin(); i_hitSelection != m_hitSelectionUInt_.end(); ++i_hitSelection){
1558  if(0 < (*i_hitSelection).second.size()){
1559  int entry(1); unsigned int intervalBegin(999);
1560  for(std::vector<unsigned int>::iterator i_hitInterval = (*i_hitSelection).second.begin(); i_hitInterval != (*i_hitSelection).second.end(); ++entry){
1561  if(entry%2==1){intervalBegin = *i_hitInterval; ++i_hitInterval;}
1562  else{
1563  if(intervalBegin > *i_hitInterval){
1564  edm::LogError("HitSelector")<<"INVALID Interval selected for "<<(*i_hitSelection).first<<":\t"<<intervalBegin<<" > "<<(*i_hitInterval)
1565  <<"\n ... delete Selection for "<<(*i_hitSelection).first;
1566  (*i_hitSelection).second.clear(); i_hitInterval = (*i_hitSelection).second.begin(); //emptyMap = true; i_hitSelection = m_hitSelection_.begin();
1567  }else{
1568  edm::LogInfo("HitSelector")<<"Interval selected for "<<(*i_hitSelection).first<<":\t"<<intervalBegin<<", "<<(*i_hitInterval);
1569  ++i_hitInterval;
1570  }
1571  }
1572  }
1573  if(0 < (*i_hitSelection).second.size())emptyMapUInt = false;
1574  }
1575  }
1576 
1577  if(emptyMap && emptyMapUInt){
1578  m_hitSelection_.clear();
1579  m_hitSelectionUInt_.clear();
1580  edm::LogInfo("HitSelector")<<"NO hit cuts applied";
1581  }
1582  return;
1583 }
std::map< std::string, std::vector< unsigned int > > m_hitSelectionUInt_
void setHitSelectionMap(const std::string &)
std::map< std::string, std::vector< double > > m_hitSelection_
void setHitSelectionMapUInt(const std::string &)
bool ApeEstimator::inDoubleInterval ( const std::vector< double > &  v_hitSelection,
const float  variable 
) const
private

Definition at line 1726 of file ApeEstimator.cc.

Referenced by hitSelected().

1726  {
1727  int entry(1); double intervalBegin(999.);
1728  bool isSelected(false);
1729  for(std::vector<double>::const_iterator i_hitInterval = v_hitSelection.begin(); i_hitInterval != v_hitSelection.end(); ++i_hitInterval, ++entry){
1730  if(entry%2==1)intervalBegin = *i_hitInterval;
1731  else if(variable>=intervalBegin && variable<*i_hitInterval)isSelected = true;
1732  }
1733  return isSelected;
1734 }
bool ApeEstimator::inUintInterval ( const std::vector< unsigned int > &  v_hitSelection,
const unsigned int  variable,
const unsigned int  variable2 = 999 
) const
private

Definition at line 1738 of file ApeEstimator.cc.

Referenced by hitSelected().

1738  {
1739  int entry(1); unsigned int intervalBegin(999);
1740  bool isSelected(false);
1741  for(std::vector<unsigned int>::const_iterator i_hitInterval = v_hitSelection.begin(); i_hitInterval != v_hitSelection.end(); ++i_hitInterval, ++entry){
1742  if(entry%2==1)intervalBegin = *i_hitInterval;
1743  else if(variable>=intervalBegin && variable<=*i_hitInterval){
1744  if(variable2==999 || (variable2>=intervalBegin && variable2<=*i_hitInterval))isSelected = true;
1745  }
1746  }
1747  return isSelected;
1748 }
bool ApeEstimator::isHit2D ( const TrackingRecHit hit) const
private

Definition at line 2117 of file ApeEstimator.cc.

References TrackingRecHit::dimension(), TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), ProjectedSiStripRecHit2D::originalHit(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, SiStripDetId::stereo(), and DetId::Tracker.

Referenced by fillTrackVariables().

2118 {
2119  // we count SiStrip stereo modules as 2D if selected via countStereoHitAs2D_
2120  // (since they provide theta information)
2121  // --- NO, here it is always set to true ---
2122  if (!hit.isValid() ||
2123  (hit.dimension() < 2 && !dynamic_cast<const SiStripRecHit1D*>(&hit))){
2124  return false; // real RecHit1D - but SiStripRecHit1D depends on countStereoHitAs2D_
2125  } else {
2126  const DetId detId(hit.geographicalId());
2127  if (detId.det() == DetId::Tracker) {
2128  if (detId.subdetId() == PixelSubdetector::PixelBarrel || detId.subdetId() == PixelSubdetector::PixelEndcap) {
2129  return true; // pixel is always 2D
2130  } else { // should be SiStrip now
2131  const SiStripDetId stripId(detId);
2132  if (stripId.stereo()) return true; // stereo modules
2133  else if (dynamic_cast<const SiStripRecHit1D*>(&hit)
2134  || dynamic_cast<const SiStripRecHit2D*>(&hit)) return false; // rphi modules hit
2135  //the following two are not used any more since ages...
2136  else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit)) return true; // matched is 2D
2137  else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) {
2138  const ProjectedSiStripRecHit2D* pH = static_cast<const ProjectedSiStripRecHit2D*>(&hit);
2139  return (this->isHit2D(pH->originalHit())); // depends on original...
2140  } else {
2141  edm::LogError("UnkownType") << "@SUB=AlignmentTrackSelector::isHit2D"
2142  << "Tracker hit not in pixel, neither SiStripRecHit[12]D nor "
2143  << "SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
2144  return false;
2145  }
2146  }
2147  } else { // not tracker??
2148  edm::LogWarning("DetectorMismatch") << "@SUB=AlignmentTrackSelector::isHit2D"
2149  << "Hit not in tracker with 'official' dimension >=2.";
2150  return true; // dimension() >= 2 so accept that...
2151  }
2152  }
2153  // never reached...
2154 }
virtual int dimension() const =0
bool isHit2D(const TrackingRecHit &) const
SiStripRecHit2D originalHit() const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:18
bool isValid() const
DetId geographicalId() const
ApeEstimator::StatePositionAndError2 ApeEstimator::positionAndError2 ( const LocalPoint localPoint,
const LocalError localError,
const TransientTrackingRecHit hit 
)
private

Definition at line 1366 of file ApeEstimator.cc.

References TrackingRecHit::detUnit(), TrackingRecHit::geographicalId(), TrackStruct::invalid, m_tkTreeVar_, RadialStripTopology::measurementError(), TrackStruct::negativeError, TrackStruct::ok, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, radialPositionAndError2(), rectangularPositionAndError2(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, GeomDetType::topology(), GeomDet::type(), MeasurementError::uu(), MeasurementError::vv(), LocalError::xx(), and LocalError::yy().

Referenced by fillHitVariables().

1366  {
1367  StatePositionAndError2 vPE2 = std::make_pair(TrackStruct::invalid,PositionAndError2());
1368 
1369  const DetId& detId(hit.geographicalId());
1370  const uint32_t& rawId(detId.rawId());
1371  const UInt_t& subdetId(m_tkTreeVar_[rawId].subdetId);
1372 
1373  if(localError.xx()<0. || localError.yy()<0.){
1374  // Do not print error message by default
1375  //edm::LogError("Negative error Value")<<"@SUB=ApeEstimator::fillHitVariables"
1376  // <<"One of the squared error methods gives negative result\n"
1377  // <<"\tSubdetector\tlocalError.xx()\tlocalError.yy()\n"
1378  // <<"\t"<<subdetId<<"\t\t"<<localError.xx()<<"\t"<<localError.yy();
1379  vPE2.first = TrackStruct::negativeError;
1380  return vPE2;
1381  }
1382 
1384  subdetId==StripSubdetector::TIB || subdetId==StripSubdetector::TOB){
1385  // Cartesian coordinates
1386  vPE2 = std::make_pair(TrackStruct::ok, this->rectangularPositionAndError2(localPoint, localError));
1387  }
1388  else if(subdetId==StripSubdetector::TID || subdetId==StripSubdetector::TEC){
1389  // Local x in radial coordinates
1390  if(!hit.detUnit())return vPE2; // is it a single physical module?
1391  const GeomDetUnit& detUnit = *hit.detUnit();
1392 
1393  if(!dynamic_cast<const RadialStripTopology*>(&detUnit.type().topology()))return vPE2;
1394  const RadialStripTopology& topol = dynamic_cast<const RadialStripTopology&>(detUnit.type().topology());
1395 
1396  MeasurementError measError = topol.measurementError(localPoint,localError);
1397  if(measError.uu()<0. || measError.vv()<0.){
1398  // Do not print error message by default
1399  //edm::LogError("Negative error Value")<<"@SUB=ApeEstimator::fillHitVariables"
1400  // <<"One of the squared error methods gives negative result\n"
1401  // <<"\tmeasError.uu()\tmeasError.vv()\n"
1402  // <<"\t"<<measError.uu()<<"\t"<<measError.vv()
1403  // <<"\n\nOriginalValues:\n"
1404  // <<localPoint.x()<<" "<<localPoint.y()<<"\n"
1405  // <<localError.xx()<<" "<<localError.yy()<<"\n"
1406  // <<"Subdet: "<<subdetId;
1407  vPE2.first = TrackStruct::negativeError;
1408  return vPE2;
1409  }
1410  vPE2 = std::make_pair(TrackStruct::ok, this->radialPositionAndError2(localPoint, localError, topol));
1411  }
1412  else{
1413  edm::LogError("FillHitVariables")<<"Incorrect subdetector ID, hit not associated to tracker";
1414  }
1415 
1416  return vPE2;
1417 }
float xx() const
Definition: LocalError.h:24
float vv() const
virtual const GeomDetType & type() const
Definition: GeomDet.cc:90
PositionAndError2 radialPositionAndError2(const LocalPoint &, const LocalError &, const RadialStripTopology &)
PositionAndError2 rectangularPositionAndError2(const LocalPoint &, const LocalError &)
std::pair< TrackStruct::HitState, PositionAndError2 > StatePositionAndError2
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
float yy() const
Definition: LocalError.h:26
float uu() const
Definition: DetId.h:18
virtual const Topology & topology() const =0
std::map< unsigned int, ReducedTrackerTreeVariables > m_tkTreeVar_
virtual const GeomDetUnit * detUnit() const
DetId geographicalId() const
ApeEstimator::PositionAndError2 ApeEstimator::radialPositionAndError2 ( const LocalPoint lP,
const LocalError lE,
const RadialStripTopology topol 
)
private

Definition at line 1435 of file ApeEstimator.cc.

References RadialStripTopology::angularWidth(), funct::cos(), RadialStripTopology::detHeight(), F(), RadialStripTopology::localStripLength(), RadialStripTopology::measurementError(), RadialStripTopology::measurementPosition(), RadialStripTopology::originToIntersection(), phi, funct::pow(), funct::sin(), RadialStripTopology::stripAngle(), MeasurementError::uu(), MeasurementError::vv(), x, PV2DBase< T, PVType, FrameType >::x(), y, PV2DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by positionAndError2().

1435  {
1436 
1437  MeasurementPoint measPos = topol.measurementPosition(lP);
1438  MeasurementError measErr = topol.measurementError(lP,lE);
1439 
1440  const float r_0 = topol.originToIntersection();
1441  const float stripLength = topol.localStripLength(lP);
1442  const float phi = topol.stripAngle(measPos.x());
1443 
1444  float x(-999.F);
1445  float y(-999.F);
1446  float errX2(-999.F);
1447  float errY2(-999.F);
1448 
1449  x = phi*r_0;
1450  // Cartesian y
1451  y = lP.y();
1452  // Trapezoidal y (symmetric around 0; length along strip)
1453  y = measPos.y()*stripLength;
1454  // Radial y (not symmetric around 0; radial distance with minimum at middle strip at lower edge [0, yMax])
1455  const float l_0 = r_0 - topol.detHeight()/2;
1456  const float cosPhi(std::cos(phi));
1457  y = measPos.y()*stripLength - 0.5*stripLength + l_0*(1./cosPhi - 1.);
1458 
1459  const float angularWidth2(topol.angularWidth()*topol.angularWidth());
1460  const float errPhi2(measErr.uu()*angularWidth2);
1461 
1462  errX2 = errPhi2*r_0*r_0;
1463  // Cartesian y
1464  errY2 = lE.yy();
1465  // Trapezoidal y (symmetric around 0, length along strip)
1466  errY2 = measErr.vv()*stripLength*stripLength;
1467  // Radial y (not symmetric around 0, real radial distance from intersection point)
1468  const float cosPhi4(std::pow(cosPhi,4)), sinPhi2(std::sin(phi)*std::sin(phi));
1469  const float helpSummand = l_0*l_0*(sinPhi2/cosPhi4*errPhi2);
1470  errY2 = measErr.vv()*stripLength*stripLength + helpSummand;
1471 
1472  return PositionAndError2(x, y, errX2, errY2);
1473 }
float vv() const
T y() const
Definition: PV2DBase.h:46
virtual float localStripLength(const LocalPoint &) const =0
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:63
virtual float detHeight() const =0
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
float yy() const
Definition: LocalError.h:26
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float uu() const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
virtual float angularWidth() const =0
virtual float stripAngle(float strip) const =0
virtual float originToIntersection() const =0
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
T x() const
Definition: PV2DBase.h:45
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
ApeEstimator::PositionAndError2 ApeEstimator::rectangularPositionAndError2 ( const LocalPoint lP,
const LocalError lE 
)
private

Definition at line 1422 of file ApeEstimator.cc.

References x, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), y, PV3DBase< T, PVType, FrameType >::y(), and LocalError::yy().

Referenced by positionAndError2().

1422  {
1423 
1424  const float x(lP.x());
1425  const float y(lP.y());
1426  const float errX2(lE.xx());
1427  const float errY2(lE.yy());
1428 
1429  return PositionAndError2(x, y, errX2, errY2);
1430 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV3DBase.h:63
float yy() const
Definition: LocalError.h:26
T x() const
Definition: PV3DBase.h:62
void ApeEstimator::residualErrorBinning ( )
private

Definition at line 526 of file ApeEstimator.cc.

References edm::ParameterSet::getParameter(), m_resErrBins_, and parameterSet_.

Referenced by beginJob().

526  {
527  std::vector<double> v_residualErrorBinning(parameterSet_.getParameter<std::vector<double> >("residualErrorBinning"));
528  if(v_residualErrorBinning.size()==1){
529  edm::LogError("ResidualErrorBinning")<<"Incorrect selection of Residual Error Bins (used for APE calculation): \t"
530  <<"Only one argument passed, so no interval is specified"
531  <<"\n... delete whole bin selection"; //m_resErrBins_ remains empty
532  return;
533  }
534  double xMin(0.), xMax(0.);
535  unsigned int binCounter(0);
536  for(std::vector<double>::const_iterator i_binning = v_residualErrorBinning.begin(); i_binning != v_residualErrorBinning.end(); ++i_binning, ++binCounter){
537  if(binCounter == 0){xMin = *i_binning;continue;}
538  xMax = *i_binning;
539  if(xMax<=xMin){
540  edm::LogError("ResidualErrorBinning")<<"Incorrect selection of Residual Error Bins (used for APE calculation): \t"
541  <<xMin<<" is bigger than "<<xMax<<" but is expected to be smaller"
542  <<"\n... delete whole bin selection";
543  m_resErrBins_.clear();
544  return;
545  }
546  m_resErrBins_[binCounter].first = xMin;
547  m_resErrBins_[binCounter].second = xMax;
548  xMin = xMax;
549  }
550  edm::LogInfo("ResidualErrorBinning")<<m_resErrBins_.size()<<" Intervals of residual errors used for separate APE calculation sucessfully set";
551 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
std::map< unsigned int, std::pair< double, double > > m_resErrBins_
void ApeEstimator::sectorBuilder ( )
private

Definition at line 252 of file ApeEstimator.cc.

References checkIntervalsForSectors(), checkModuleBools(), checkModuleDirections(), checkModuleIds(), checkModulePositions(), F(), edm::ParameterSet::getParameter(), TrackerSectorStruct::isPixel, m_tkSector_, m_tkTreeVar_, python.rootplot.argparse::module, TrackerSectorStruct::name, ReducedTrackerTreeVariables::nStrips, parameterSet_, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, relativeConstraints::ring, statistics(), AlCaHLTBitMon_QueryRunRegistry::string, ReducedTrackerTreeVariables::subdetId, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, ReducedTrackerTreeVariables::uDirection, TrackerSectorStruct::v_rawId, ReducedTrackerTreeVariables::vDirection, and ReducedTrackerTreeVariables::wDirection.

Referenced by beginJob().

252  {
253 
254  TFile* tkTreeFile(TFile::Open((parameterSet_.getParameter<std::string>("TrackerTreeFile")).c_str()));
255  if(tkTreeFile){
256  edm::LogInfo("SectorBuilder")<<"TrackerTreeFile OK";
257  }else{
258  edm::LogError("SectorBuilder")<<"TrackerTreeFile not found";
259  return;
260  }
261  TTree* tkTree(0);
262  tkTreeFile->GetObject("TrackerTreeGenerator/TrackerTree/TrackerTree",tkTree);
263  if(tkTree){
264  edm::LogInfo("SectorBuilder")<<"TrackerTree OK";
265  }else{
266  edm::LogError("SectorBuilder")<<"TrackerTree not found in file";
267  return;
268  }
269  UInt_t rawId(999), subdetId(999), layer(999), side(999), half(999), rod(999), ring(999), petal(999),
270  blade(999), panel(999), outerInner(999), module(999), rodAl(999), bladeAl(999), nStrips(999);
271  Bool_t isDoubleSide(false), isRPhi(false);
272  Int_t uDirection(999), vDirection(999), wDirection(999);
273  Float_t posR(999.F), posPhi(999.F), posEta(999.F), posX(999.F), posY(999.F), posZ(999.F);
274  tkTree->SetBranchAddress("RawId", &rawId);
275  tkTree->SetBranchAddress("SubdetId", &subdetId);
276  tkTree->SetBranchAddress("Layer", &layer);
277  tkTree->SetBranchAddress("Side", &side);
278  tkTree->SetBranchAddress("Half", &half);
279  tkTree->SetBranchAddress("Rod", &rod);
280  tkTree->SetBranchAddress("Ring", &ring);
281  tkTree->SetBranchAddress("Petal", &petal);
282  tkTree->SetBranchAddress("Blade", &blade);
283  tkTree->SetBranchAddress("Panel", &panel);
284  tkTree->SetBranchAddress("OuterInner", &outerInner);
285  tkTree->SetBranchAddress("Module", &module);
286  tkTree->SetBranchAddress("RodAl", &rodAl);
287  tkTree->SetBranchAddress("BladeAl", &bladeAl);
288  tkTree->SetBranchAddress("NStrips", &nStrips);
289  tkTree->SetBranchAddress("IsDoubleSide", &isDoubleSide);
290  tkTree->SetBranchAddress("IsRPhi", &isRPhi);
291  tkTree->SetBranchAddress("UDirection", &uDirection);
292  tkTree->SetBranchAddress("VDirection", &vDirection);
293  tkTree->SetBranchAddress("WDirection", &wDirection);
294  tkTree->SetBranchAddress("PosR", &posR);
295  tkTree->SetBranchAddress("PosPhi", &posPhi);
296  tkTree->SetBranchAddress("PosEta", &posEta);
297  tkTree->SetBranchAddress("PosX", &posX);
298  tkTree->SetBranchAddress("PosY", &posY);
299  tkTree->SetBranchAddress("PosZ", &posZ);
300 
301  Int_t nModules(tkTree->GetEntries());
302  TrackerSectorStruct allSectors;
303 
304  //Loop over all Sectors
305  unsigned int sectorCounter(1);
306  std::vector<edm::ParameterSet> v_sectorDef(parameterSet_.getParameter<std::vector<edm::ParameterSet> >("Sectors"));
307  edm::LogInfo("SectorBuilder")<<"There are "<<v_sectorDef.size()<<" Sectors definded";
308  std::vector<edm::ParameterSet>::const_iterator i_parSet;
309  for(i_parSet = v_sectorDef.begin(); i_parSet != v_sectorDef.end();++i_parSet, ++sectorCounter){
310  const edm::ParameterSet& parSet = *i_parSet;
311  const std::string& sectorName(parSet.getParameter<std::string>("name"));
312  std::vector<unsigned int> v_rawId(parSet.getParameter<std::vector<unsigned int> >("rawId")),
313  v_subdetId(parSet.getParameter<std::vector<unsigned int> >("subdetId")),
314  v_layer(parSet.getParameter<std::vector<unsigned int> >("layer")),
315  v_side(parSet.getParameter<std::vector<unsigned int> >("side")),
316  v_half(parSet.getParameter<std::vector<unsigned int> >("half")),
317  v_rod(parSet.getParameter<std::vector<unsigned int> >("rod")),
318  v_ring(parSet.getParameter<std::vector<unsigned int> >("ring")),
319  v_petal(parSet.getParameter<std::vector<unsigned int> >("petal")),
320  v_blade(parSet.getParameter<std::vector<unsigned int> >("blade")),
321  v_panel(parSet.getParameter<std::vector<unsigned int> >("panel")),
322  v_outerInner(parSet.getParameter<std::vector<unsigned int> >("outerInner")),
323  v_module(parSet.getParameter<std::vector<unsigned int> >("module")),
324  v_rodAl(parSet.getParameter<std::vector<unsigned int> >("rodAl")),
325  v_bladeAl(parSet.getParameter<std::vector<unsigned int> >("bladeAl")),
326  v_nStrips(parSet.getParameter<std::vector<unsigned int> >("nStrips")),
327  v_isDoubleSide(parSet.getParameter<std::vector<unsigned int> >("isDoubleSide")),
328  v_isRPhi(parSet.getParameter<std::vector<unsigned int> >("isRPhi"));
329  std::vector<int> v_uDirection(parSet.getParameter<std::vector<int> >("uDirection")),
330  v_vDirection(parSet.getParameter<std::vector<int> >("vDirection")),
331  v_wDirection(parSet.getParameter<std::vector<int> >("wDirection"));
332  std::vector<double> v_posR(parSet.getParameter<std::vector<double> >("posR")),
333  v_posPhi(parSet.getParameter<std::vector<double> >("posPhi")),
334  v_posEta(parSet.getParameter<std::vector<double> >("posEta")),
335  v_posX(parSet.getParameter<std::vector<double> >("posX")),
336  v_posY(parSet.getParameter<std::vector<double> >("posY")),
337  v_posZ(parSet.getParameter<std::vector<double> >("posZ"));
338 
339  if(!this->checkIntervalsForSectors(sectorCounter,v_posR) || !this->checkIntervalsForSectors(sectorCounter,v_posPhi) ||
340  !this->checkIntervalsForSectors(sectorCounter,v_posEta) || !this->checkIntervalsForSectors(sectorCounter,v_posX) ||
341  !this->checkIntervalsForSectors(sectorCounter,v_posY) || !this->checkIntervalsForSectors(sectorCounter,v_posZ))continue;
342 
343 
344  TrackerSectorStruct tkSector;
345  tkSector.name = sectorName;
346 
347  ReducedTrackerTreeVariables tkTreeVar;
348 
349  //Loop over all Modules
350  for(Int_t module = 0; module < nModules; ++module){
351  tkTree->GetEntry(module);
352 
353  if(sectorCounter==1){
354  tkTreeVar.subdetId = subdetId;
355  tkTreeVar.nStrips = nStrips;
356  tkTreeVar.uDirection = uDirection;
357  tkTreeVar.vDirection = vDirection;
358  tkTreeVar.wDirection = wDirection;
359  m_tkTreeVar_[rawId] = tkTreeVar;
360  }
361 
362  if(!this->checkModuleIds(rawId,v_rawId))continue;
363  if(!this->checkModuleIds(subdetId,v_subdetId))continue;
364  if(!this->checkModuleIds(layer,v_layer))continue;
365  if(!this->checkModuleIds(side,v_side))continue;
366  if(!this->checkModuleIds(half,v_half))continue;
367  if(!this->checkModuleIds(rod,v_rod))continue;
368  if(!this->checkModuleIds(ring,v_ring))continue;
369  if(!this->checkModuleIds(petal,v_petal))continue;
370  if(!this->checkModuleIds(blade,v_blade))continue;
371  if(!this->checkModuleIds(panel,v_panel))continue;
372  if(!this->checkModuleIds(outerInner,v_outerInner))continue;
373  if(!this->checkModuleIds(module,v_module))continue;
374  if(!this->checkModuleIds(rodAl,v_rodAl))continue;
375  if(!this->checkModuleIds(bladeAl,v_bladeAl))continue;
376  if(!this->checkModuleIds(nStrips,v_nStrips))continue;
377  if(!this->checkModuleBools(isDoubleSide,v_isDoubleSide))continue;
378  if(!this->checkModuleBools(isRPhi,v_isRPhi))continue;
379  if(!this->checkModuleDirections(uDirection,v_uDirection))continue;
380  if(!this->checkModuleDirections(vDirection,v_vDirection))continue;
381  if(!this->checkModuleDirections(wDirection,v_wDirection))continue;
382  if(!this->checkModulePositions(posR,v_posR))continue;
383  if(!this->checkModulePositions(posPhi,v_posPhi))continue;
384  if(!this->checkModulePositions(posEta,v_posEta))continue;
385  if(!this->checkModulePositions(posX,v_posX))continue;
386  if(!this->checkModulePositions(posY,v_posY))continue;
387  if(!this->checkModulePositions(posZ,v_posZ))continue;
388 
389  tkSector.v_rawId.push_back(rawId);
390  bool moduleSelected(false);
391  for(std::vector<unsigned int>::const_iterator i_rawId = allSectors.v_rawId.begin();
392  i_rawId != allSectors.v_rawId.end(); ++i_rawId){
393  if(rawId == *i_rawId)moduleSelected = true;
394  }
395  if(!moduleSelected)allSectors.v_rawId.push_back(rawId);
396  }
397 
398  bool isPixel(false);
399  bool isStrip(false);
400  for(std::vector<unsigned int>::const_iterator i_rawId = tkSector.v_rawId.begin();
401  i_rawId != tkSector.v_rawId.end(); ++i_rawId){
402  if(m_tkTreeVar_[*i_rawId].subdetId==PixelSubdetector::PixelBarrel || m_tkTreeVar_[*i_rawId].subdetId==PixelSubdetector::PixelEndcap){
403  isPixel = true;
404  }
405  if(m_tkTreeVar_[*i_rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[*i_rawId].subdetId==StripSubdetector::TOB ||
406  m_tkTreeVar_[*i_rawId].subdetId==StripSubdetector::TID || m_tkTreeVar_[*i_rawId].subdetId==StripSubdetector::TEC){
407  isStrip = true;
408  }
409  }
410 
411  if(isPixel && isStrip){
412  edm::LogError("SectorBuilder")<<"Incorrect Sector Definition: there are pixel and strip modules within one sector"
413  <<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
414  continue;
415  }
416  tkSector.isPixel = isPixel;
417 
418  m_tkSector_[sectorCounter] = tkSector;
419  edm::LogInfo("SectorBuilder")<<"There are "<<tkSector.v_rawId.size()<<" Modules in Sector "<<sectorCounter;
420  }
421  this->statistics(allSectors, nModules);
422  return;
423 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
void statistics(const TrackerSectorStruct &, const Int_t) const
bool checkModulePositions(const float, const std::vector< double > &) const
bool checkModuleBools(const bool, const std::vector< unsigned int > &) const
bool checkModuleIds(const unsigned int, const std::vector< unsigned int > &) const
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
bool checkIntervalsForSectors(const unsigned int sectorCounter, const std::vector< double > &) const
bool checkModuleDirections(const int, const std::vector< int > &) const
std::map< unsigned int, ReducedTrackerTreeVariables > m_tkTreeVar_
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
Definition: vlib.h:208
std::vector< unsigned int > v_rawId
void ApeEstimator::setHitSelectionMap ( const std::string &  cutVariable)
private

Definition at line 1588 of file ApeEstimator.cc.

References edm::ParameterSet::getParameter(), m_hitSelection_, and parameterSet_.

Referenced by hitSelection().

1588  {
1590  std::vector<double> v_cutVariable(parSet.getParameter<std::vector<double> >(cutVariable));
1591  if(v_cutVariable.size()%2==1){
1592  edm::LogError("HitSelector")<<"Invalid Hit Selection for "<<cutVariable<<": need even number of arguments (intervals)"
1593  <<"\n ... delete Selection for "<<cutVariable;
1594  v_cutVariable.clear();
1595  m_hitSelection_[cutVariable] = v_cutVariable;
1596  return;
1597  }
1598  m_hitSelection_[cutVariable] = v_cutVariable;
1599  return;
1600 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
std::map< std::string, std::vector< double > > m_hitSelection_
void ApeEstimator::setHitSelectionMapUInt ( const std::string &  cutVariable)
private

Definition at line 1604 of file ApeEstimator.cc.

References edm::ParameterSet::getParameter(), m_hitSelectionUInt_, and parameterSet_.

Referenced by hitSelection().

1604  {
1606  std::vector<unsigned int> v_cutVariable(parSet.getParameter<std::vector<unsigned int> >(cutVariable));
1607  if(v_cutVariable.size()%2==1){
1608  edm::LogError("HitSelector")<<"Invalid Hit Selection for "<<cutVariable<<": need even number of arguments (intervals)"
1609  <<"\n ... delete Selection for "<<cutVariable;
1610  v_cutVariable.clear();
1611  m_hitSelectionUInt_[cutVariable] = v_cutVariable;
1612  return;
1613  }
1614  m_hitSelectionUInt_[cutVariable] = v_cutVariable;
1615  return;
1616 }
T getParameter(std::string const &) const
const edm::ParameterSet parameterSet_
std::map< std::string, std::vector< unsigned int > > m_hitSelectionUInt_
void ApeEstimator::statistics ( const TrackerSectorStruct allSectors,
const Int_t  nModules 
) const
private

Definition at line 491 of file ApeEstimator.cc.

References m_tkSector_, and TrackerSectorStruct::v_rawId.

Referenced by sectorBuilder().

491  {
492  bool commonModules(false);
493  for(std::map<unsigned int,TrackerSectorStruct>::const_iterator i_sector = m_tkSector_.begin(); i_sector != m_tkSector_.end(); ++i_sector){
494  std::map<unsigned int,TrackerSectorStruct>::const_iterator i_sector2(i_sector);
495  for(++i_sector2; i_sector2 != m_tkSector_.end(); ++i_sector2){
496  unsigned int nCommonModules(0);
497  for(std::vector<unsigned int>::const_iterator i_module = (*i_sector).second.v_rawId.begin(); i_module != (*i_sector).second.v_rawId.end(); ++i_module){
498  for(std::vector<unsigned int>::const_iterator i_module2 = (*i_sector2).second.v_rawId.begin(); i_module2 != (*i_sector2).second.v_rawId.end(); ++i_module2){
499  if(*i_module2 == *i_module)++nCommonModules;
500  }
501  }
502  if(nCommonModules==0)
503  ;//edm::LogInfo("SectorBuilder")<<"Sector "<<(*i_sector).first<<" and Sector "<<(*i_sector2).first<< " have ZERO Modules in common";
504  else{
505  edm::LogError("SectorBuilder")<<"Sector "<<(*i_sector).first<<" and Sector "<<(*i_sector2).first<< " have "<<nCommonModules<<" Modules in common";
506  commonModules = true;
507  }
508  }
509  }
510  if(static_cast<int>(allSectors.v_rawId.size())==nModules)
511  edm::LogInfo("SectorBuilder")<<"ALL Tracker Modules are contained in the Sectors";
512  else
513  edm::LogWarning("SectorBuilder")<<"There are "<<allSectors.v_rawId.size()<<" Modules in all Sectors"
514  <<" out of "<<nModules<<" Tracker Modules";
515  if(!commonModules)
516  edm::LogInfo("SectorBuilder")<<"There are ZERO modules associated to different sectors, no ambiguities exist";
517  else
518  edm::LogError("SectorBuilder")<<"There are modules associated to different sectors, APE value cannot be assigned reasonably";
519 }
std::map< unsigned int, TrackerSectorStruct > m_tkSector_
std::vector< unsigned int > v_rawId

Member Data Documentation

const bool ApeEstimator::analyzerMode_
private

Definition at line 208 of file ApeEstimator.cc.

Referenced by analyze(), and beginJob().

const bool ApeEstimator::calculateApe_
private

Definition at line 210 of file ApeEstimator.cc.

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

unsigned int ApeEstimator::counter1
private

Definition at line 212 of file ApeEstimator.cc.

Referenced by ApeEstimator(), endJob(), and fillHitVariables().

unsigned int ApeEstimator::counter2
private

Definition at line 212 of file ApeEstimator.cc.

Referenced by ApeEstimator().

unsigned int ApeEstimator::counter3
private

Definition at line 212 of file ApeEstimator.cc.

Referenced by ApeEstimator().

unsigned int ApeEstimator::counter4
private

Definition at line 212 of file ApeEstimator.cc.

Referenced by ApeEstimator().

unsigned int ApeEstimator::counter5
private

Definition at line 212 of file ApeEstimator.cc.

Referenced by ApeEstimator().

unsigned int ApeEstimator::counter6
private

Definition at line 212 of file ApeEstimator.cc.

Referenced by ApeEstimator().

std::map<std::string,std::vector<double> > ApeEstimator::m_hitSelection_
private

Definition at line 200 of file ApeEstimator.cc.

Referenced by hitSelected(), hitSelection(), and setHitSelectionMap().

std::map<std::string,std::vector<unsigned int> > ApeEstimator::m_hitSelectionUInt_
private

Definition at line 201 of file ApeEstimator.cc.

Referenced by hitSelected(), hitSelection(), and setHitSelectionMapUInt().

std::map<unsigned int, std::pair<double,double> > ApeEstimator::m_resErrBins_
private
std::map<unsigned int, TrackerSectorStruct> ApeEstimator::m_tkSector_
private
std::map<unsigned int, ReducedTrackerTreeVariables> ApeEstimator::m_tkTreeVar_
private

Definition at line 198 of file ApeEstimator.cc.

Referenced by fillHitVariables(), positionAndError2(), and sectorBuilder().

const unsigned int ApeEstimator::maxTracksPerEvent_
private

Definition at line 205 of file ApeEstimator.cc.

Referenced by analyze().

const unsigned int ApeEstimator::minGoodHitsPerTrack_
private

Definition at line 206 of file ApeEstimator.cc.

Referenced by fillHistsForAnalyzerMode(), and fillHistsForApeCalculation().

edm::EDGetTokenT<reco::BeamSpot> ApeEstimator::offlinebeamSpot_
private

Definition at line 194 of file ApeEstimator.cc.

Referenced by analyze().

const edm::ParameterSet ApeEstimator::parameterSet_
private
edm::EDGetTokenT<TrajTrackAssociationCollection> ApeEstimator::tjTagToken_
private

Definition at line 193 of file ApeEstimator.cc.

Referenced by analyze().

TrackerDetectorStruct ApeEstimator::tkDetector_
private

Definition at line 191 of file ApeEstimator.cc.

Referenced by analyze(), bookTrackHists(), and fillHistsForAnalyzerMode().

bool ApeEstimator::trackCut_
private

Definition at line 203 of file ApeEstimator.cc.

Referenced by analyze(), and fillTrackVariables().