Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in Halo code #7433

Merged
merged 1 commit into from Jan 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion DQMOffline/JetMET/src/BeamHaloAnalyzer.cc
Expand Up @@ -610,7 +610,7 @@ void BeamHaloAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup&
//Access selected SuperClusters
for(unsigned int n = 0 ; n < EcalData.GetSuperClusters().size() ; n++ )
{
edm::Ref<SuperClusterCollection> cluster(EcalData.GetSuperClusters(), n );
edm::Ref<SuperClusterCollection> cluster(EcalData.GetSuperClusters()[n] );
float angle = vm_Angle[cluster];
float roundness = vm_Roundness[cluster];
hEcalHaloData_SuperClusterShowerShapes->Fill(angle, roundness);
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/METReco/src/CSCHaloData.cc
Expand Up @@ -54,7 +54,7 @@ int CSCHaloData::NumberOfHaloTracks(HaloData::Endcap z) const
int n = 0 ;
for(unsigned int i = 0 ; i < TheTrackRefs.size() ; i++ )
{
edm::Ref<reco::TrackCollection> iTrack( TheTrackRefs, i ) ;
edm::Ref<reco::TrackCollection> iTrack( TheTrackRefs[i] ) ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this a bug?
Ref(RefVector<C, T, F> const& refvector, key_type itemKey) exists
is the point that it's becoming a bug with updates of the interface?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Say the code was

std::vector<Foo*> allFoos;
std::vector<Foo*> someFoos( aFunctionThatMakesChoices(allFoos) );

for(unsigned int i = 0; i< someFoos.size(); i++) {
   std::cout << allFoos[i];
}

Would you consider using the wrong size to be a bug? That is exactly what the code was doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, the RefVector might have 5 entries and the TrackCollection might have 1000 tracks. The 3rd element of the RefVector might reference the 500th track. The existing constructor is passing an index into the RefVector into a function that expects and index into the TrackCollection, In this example, passing 3 instead of 500.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, indeed.
Now it's obvious

// Does the track go through both endcaps ?
bool Traversing = (iTrack->outerPosition().z() > 0 && iTrack->innerPosition().z() < 0) || (iTrack->outerPosition().z() < 0 && iTrack->innerPosition().z() > 0);
// Does the track go through only +Z endcap ?
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/METReco/src/EcalHaloData.cc
Expand Up @@ -17,7 +17,7 @@ int EcalHaloData::NumberOfHaloSuperClusters(float roundness, float angle ) const
int n = 0 ;
for( unsigned int i = 0 ; i < TheSuperClusterRefs.size() ; i++ )
{
edm::Ref<SuperClusterCollection> cluster(TheSuperClusterRefs, i) ;
edm::Ref<SuperClusterCollection> cluster(TheSuperClusterRefs[i]) ;
float r = ShowerShapes_Roundness[cluster];
float a = ShowerShapes_Angle[cluster];

Expand Down
2 changes: 1 addition & 1 deletion RecoMET/METProducers/src/BeamHaloSummaryProducer.cc
Expand Up @@ -143,7 +143,7 @@ void BeamHaloSummaryProducer::produce(Event& iEvent, const EventSetup& iSetup)
//Access selected SuperClusters
for(unsigned int n = 0 ; n < EcalData.GetSuperClusters().size() ; n++ )
{
edm::Ref<SuperClusterCollection> cluster(EcalData.GetSuperClusters(), n );
edm::Ref<SuperClusterCollection> cluster(EcalData.GetSuperClusters()[n] );

float angle = vm_Angle[cluster];
float roundness = vm_Roundness[cluster];
Expand Down