Skip to content

Commit

Permalink
Merge pull request #7 from cms-sw/CMSSW_7_1_X
Browse files Browse the repository at this point in the history
Update my CMSSW_7_1_X with the official one
  • Loading branch information
venturia committed Mar 22, 2014
2 parents 579e365 + acb0d0a commit 575c0e6
Show file tree
Hide file tree
Showing 1,950 changed files with 97,269 additions and 97,208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ class CurrentAlignmentKFUpdator : public TrajectoryStateUpdator
~CurrentAlignmentKFUpdator( void ) {}

template <unsigned int D>
TrajectoryStateOnSurface update( const TrajectoryStateOnSurface &, const TransientTrackingRecHit & ) const;
TrajectoryStateOnSurface update( const TrajectoryStateOnSurface &, const TrackingRecHit & ) const;

TrajectoryStateOnSurface update( const TrajectoryStateOnSurface &, const TransientTrackingRecHit & ) const;
TrajectoryStateOnSurface update( const TrajectoryStateOnSurface &, const TrackingRecHit & ) const;

virtual CurrentAlignmentKFUpdator * clone( void ) const { return new CurrentAlignmentKFUpdator( *this ); }

private:

template <unsigned int D>
void includeCurrentAlignmentEstimate( const TransientTrackingRecHit & aRecHit,
void includeCurrentAlignmentEstimate( const TrackingRecHit & aRecHit,
const TrajectoryStateOnSurface & tsos,
typename AlgebraicROOTObject<D>::Vector & vecR,
typename AlgebraicROOTObject<D>::SymMatrix & matV ) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


TrajectoryStateOnSurface CurrentAlignmentKFUpdator::update( const TrajectoryStateOnSurface & tsos,
const TransientTrackingRecHit & aRecHit ) const
const TrackingRecHit & aRecHit ) const
{
switch (aRecHit.dimension()) {
case 1: return update<1>(tsos,aRecHit);
Expand All @@ -24,7 +24,7 @@ TrajectoryStateOnSurface CurrentAlignmentKFUpdator::update( const TrajectoryStat

template <unsigned int D>
TrajectoryStateOnSurface CurrentAlignmentKFUpdator::update( const TrajectoryStateOnSurface & tsos,
const TransientTrackingRecHit & aRecHit ) const
const TrackingRecHit & aRecHit ) const
{
//std::cout << "[CurrentAlignmentKFUpdator::update] Start Updating." << std::endl;
typedef typename AlgebraicROOTObject<D,5>::Matrix MatD5;
Expand Down Expand Up @@ -77,7 +77,7 @@ TrajectoryStateOnSurface CurrentAlignmentKFUpdator::update( const TrajectoryStat


template <unsigned int D>
void CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate( const TransientTrackingRecHit & aRecHit,
void CurrentAlignmentKFUpdator::includeCurrentAlignmentEstimate( const TrackingRecHit & aRecHit,
const TrajectoryStateOnSurface & tsos,
typename AlgebraicROOTObject<D>::Vector & vecR,
typename AlgebraicROOTObject<D>::SymMatrix & matV ) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/transform.h"

#include "CalibFormats/SiStripObjects/interface/SiStripGain.h"
#include "CalibTracker/Records/interface/SiStripGainRcd.h"
Expand All @@ -14,8 +15,10 @@

#include <functional>

SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterSet const& conf)
SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterSet const& conf)
: inputTags(conf.getParameter<std::vector<edm::InputTag> >("DigiProducersList")),
inputTokensDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripDigi> >(tag);})),
inputTokensRawDigi(edm::vector_transform(inputTags, [this](edm::InputTag const & tag){return consumes<edm::DetSetVector<SiStripRawDigi> >(tag);})),
subtractorPed(SiStripRawProcessingFactory::create_SubtractorPed(conf)),
subtractorCMN(SiStripRawProcessingFactory::create_SubtractorCMN(conf)){

Expand All @@ -26,18 +29,18 @@ void SiStripProcessedRawDigiProducer::
produce(edm::Event& e, const edm::EventSetup& es) {

std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
edm::Handle< edm::DetSetVector<SiStripDigi> > inputDigis;
edm::Handle< edm::DetSetVector<SiStripRawDigi> > inputRawdigis;
edm::Handle< edm::DetSetVector<SiStripDigi> > inputDigis;
edm::Handle< edm::DetSetVector<SiStripRawDigi> > inputRawdigis;

es.get<SiStripGainRcd>().get(gainHandle);
subtractorPed->init(es);
subtractorCMN->init(es);
std::string label = findInput(inputRawdigis, e);
if( "VirginRaw" == label ) vr_process(*inputRawdigis, *output);
else if( "ProcessedRaw" == label ) pr_process(*inputRawdigis, *output);
else if( "ZeroSuppressed" == findInput(inputDigis,e) ) zs_process(*inputDigis, *output);
else

std::string label = findInput(inputRawdigis, inputTokensRawDigi, e);
if( "VirginRaw" == label ) vr_process(*inputRawdigis, *output);
else if( "ProcessedRaw" == label ) pr_process(*inputRawdigis, *output);
else if( "ZeroSuppressed" == findInput(inputDigis, inputTokensDigi, e) ) zs_process(*inputDigis, *output);
else
edm::LogError("Input Not Found");

e.put(output);
Expand All @@ -46,21 +49,20 @@ produce(edm::Event& e, const edm::EventSetup& es) {
template<class T>
inline
std::string SiStripProcessedRawDigiProducer::
findInput(edm::Handle<T>& handle, const edm::Event& e ) {
findInput(edm::Handle<T>& handle, const std::vector<edm::EDGetTokenT<T> >& tokens, const edm::Event& e ) {

for( std::vector<edm::InputTag>::const_iterator
inputTag = inputTags.begin(); inputTag != inputTags.end(); ++inputTag ) {

e.getByLabel(*inputTag, handle);
for( typename std::vector<edm::EDGetTokenT<T> >::const_iterator
token = tokens.begin(); token != tokens.end(); ++token ) {
unsigned index(token - tokens.begin());
e.getByToken(*token, handle);
if( handle.isValid() && !handle->empty() ) {
edm::LogInfo("Input") << *inputTag;
return inputTag->instance();
edm::LogInfo("Input") << inputTags.at(index);
return inputTags.at(index).instance();
}
}
return "Input Not Found";
}


void SiStripProcessedRawDigiProducer::
zs_process(const edm::DetSetVector<SiStripDigi> & input, edm::DetSetVector<SiStripProcessedRawDigi>& output) {
std::vector<float> digis;
Expand Down Expand Up @@ -99,12 +101,12 @@ void SiStripProcessedRawDigiProducer::
common_process(const uint32_t detId, std::vector<float> & digis, edm::DetSetVector<SiStripProcessedRawDigi>& output) {

//Apply Gains
SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
for(std::vector<float>::iterator it=digis.begin(); it<digis.end(); it++)
SiStripApvGain::Range detGainRange = gainHandle->getRange(detId);
for(std::vector<float>::iterator it=digis.begin(); it<digis.end(); it++)
(*it)/= (gainHandle->getStripGain(it-digis.begin(), detGainRange));

//Insert as DetSet
edm::DetSet<SiStripProcessedRawDigi> ds(detId);
copy(digis.begin(), digis.end(), back_inserter(ds.data) );
copy(digis.begin(), digis.end(), back_inserter(ds.data) );
output.insert(ds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h"

#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
#include <memory>
#include <string>

class SiStripGain;
class SiStripDigi;
class SiStripRawDigi;
class SiStripProcessedRawDigi;

class SiStripProcessedRawDigiProducer : public edm::EDProducer {

public:

explicit SiStripProcessedRawDigiProducer(edm::ParameterSet const&);

private:

void produce(edm::Event& e, const edm::EventSetup& es);
template<class T> std::string findInput(edm::Handle<T>& handle, const edm::Event& e);
template<class T> std::string findInput(edm::Handle<T>& handle, const std::vector<edm::EDGetTokenT<T> >& tokens, const edm::Event& e);

void vr_process(const edm::DetSetVector<SiStripRawDigi>&, edm::DetSetVector<SiStripProcessedRawDigi>&);
void pr_process(const edm::DetSetVector<SiStripRawDigi>&, edm::DetSetVector<SiStripProcessedRawDigi>&);
Expand All @@ -37,11 +37,13 @@ class SiStripProcessedRawDigiProducer : public edm::EDProducer {


std::vector<edm::InputTag> inputTags;
std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> > > inputTokensDigi;
std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > > inputTokensRawDigi;
edm::ESHandle<SiStripGain> gainHandle;

std::auto_ptr<SiStripPedestalsSubtractor> subtractorPed;
std::auto_ptr<SiStripCommonModeNoiseSubtractor> subtractorCMN;

};
#endif
#endif

23 changes: 14 additions & 9 deletions AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,40 @@
//
// Package: RecoTracker/TrackInfoProducer
// Class: TrackInfoProducer
//
//
//
// Description: Produce TrackInfo from Trajectory
//
//
// Original Author: Chiara Genta
// Created:
// Created:
//

#include "AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducerAlgorithm.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"

class TrackInfoProducer : public edm::EDProducer {
public:

// TrackInfoProducer(){}
explicit TrackInfoProducer(const edm::ParameterSet& iConfig);

virtual ~TrackInfoProducer(){};

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


private:
edm::ParameterSet conf_;
TrackInfoProducerAlgorithm theAlgo_;
edm::EDGetTokenT<std::vector<Trajectory> > TrajectoryToken_;
edm::EDGetTokenT<reco::TrackCollection> trackCollectionToken_;
edm::EDGetTokenT<TrajTrackAssociationCollection> assoMapToken_;
std::string forwardPredictedStateTag_, backwardPredictedStateTag_, updatedStateTag_, combinedStateTag_;
};
#endif
32 changes: 15 additions & 17 deletions AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "AnalysisDataFormats/TrackInfo/interface/TrackInfo.h"
#include "AnalysisDataFormats/TrackInfo/interface/TrackInfoTrackAssociation.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
TrackInfoProducer::TrackInfoProducer(const edm::ParameterSet& iConfig):
conf_(iConfig),
theAlgo_(iConfig)
theAlgo_(iConfig),
TrajectoryToken_(consumes<std::vector<Trajectory> >(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
trackCollectionToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks"))),
assoMapToken_(consumes<TrajTrackAssociationCollection>(iConfig.getParameter<edm::InputTag>("cosmicTracks")))
{
produces<reco::TrackInfoCollection>();
produces<reco::TrackInfoTrackAssociationCollection>();
Expand All @@ -29,26 +29,24 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set

std::auto_ptr<reco::TrackInfoCollection> outputColl (new reco::TrackInfoCollection);
std::auto_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl (new reco::TrackInfoTrackAssociationCollection);

edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("cosmicTracks");


edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
edm::Handle<reco::TrackCollection > trackCollection;
edm::Handle<TrajTrackAssociationCollection> assoMap;

edm::ESHandle<TrackerGeometry> tkgeom;
setup.get<TrackerDigiGeometryRecord>().get( tkgeom );
const TrackerGeometry * tracker=&(* tkgeom);
theEvent.getByLabel(TkTag,TrajectoryCollection);
theEvent.getByLabel(TkTag,trackCollection);
theEvent.getByLabel(TkTag,assoMap);

theEvent.getByToken(TrajectoryToken_,TrajectoryCollection);
theEvent.getByToken(trackCollectionToken_,trackCollection);
theEvent.getByToken(assoMapToken_,assoMap);

//
//run the algorithm
//run the algorithm
//
reco::TrackInfo output;

std::vector<Trajectory>::const_iterator traj_iterator;
edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
std::map<reco::TrackRef,unsigned int> trackid;
Expand All @@ -63,7 +61,7 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set
outputColl->push_back(*(new reco::TrackInfo(output)));

}


//put everything in the event
edm::OrphanHandle<reco::TrackInfoCollection> rTrackInfo;
Expand All @@ -79,7 +77,7 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set
TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
}

theEvent.put(TIassociationColl);
theEvent.put(TIassociationColl);
}


Expand Down
31 changes: 17 additions & 14 deletions AnalysisAlgos/TrackInfoProducer/test/TrackInfoAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ using namespace edm;

class TrackInfoAnalyzer : public edm::EDAnalyzer {
public:
TrackInfoAnalyzer(const edm::ParameterSet& pset) {conf_=pset;}
TrackInfoAnalyzer(const edm::ParameterSet& pset);
void beginJob(){
// cout << "beginJob" <<endl;
// edm::ESHandle<TrackerGeometry> tkgeom;
// c.get<TrackerDigiGeometryRecord>().get( tkgeom );
// tracker=&(* tkgeom);
std::string filename = conf_.getParameter<std::string>("OutFileName");
output = new TFile(filename.c_str(), "RECREATE");
tib1int = new TH1F("Tib1Int", "Tib Layer 1 Int", 100, -1, 1);
tib1ext = new TH1F("Tib1Ext", "Tib Layer 1 Ext", 100, -1, 1);
Expand All @@ -39,13 +38,11 @@ class TrackInfoAnalyzer : public edm::EDAnalyzer {
tib3ext = new TH1F("Tib3Ext", "Tib Layer 3 Ext", 100, -0.5, 0.5);
tib4int = new TH1F("Tib4Int", "Tib Layer 4 Int", 100, -0.5, 0.5);
tib4ext = new TH1F("Tib4Ext", "Tib Layer 4 Ext", 100, -0.5, 0.5);

}
}

~TrackInfoAnalyzer(){
delete output;
}
edm::ParameterSet conf_;

virtual void analyze(const edm::Event& event, const edm::EventSetup& setup){ //analyze

Expand All @@ -57,15 +54,14 @@ class TrackInfoAnalyzer : public edm::EDAnalyzer {
const TrackerTopology* const tTopo = tTopoHandle.product();

//std::cout << "\nEvent ID = "<< event.id() << std::endl ;
edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("TrackInfo");
edm::Handle<reco::TrackInfoCollection> trackCollection;
event.getByLabel(TkTag, trackCollection);
event.getByToken(trackCollectionToken, trackCollection);

reco::TrackInfoCollection tC = *(trackCollection.product());

edm::LogInfo("TrackInfoAnalyzer") <<"number of infos "<< tC.size();
for (reco::TrackInfoCollection::iterator track=tC.begin(); track!=tC.end(); track++){

//const reco::TrackInfo::TrajectoryInfo tinfo=track->trajstate();
reco::TrackInfo::TrajectoryInfo::const_iterator iter;
edm::LogInfo("TrackInfoAnalyzer") <<"N hits in the seed: "<<track->seed().nHits();
Expand Down Expand Up @@ -107,17 +103,24 @@ class TrackInfoAnalyzer : public edm::EDAnalyzer {
}
private:
TFile * output;
TH1F* tib1int;
TH1F* tib1int;
TH1F* tib1ext;
TH1F* tib2int;
TH1F* tib2int;
TH1F* tib2ext;
TH1F* tib3int;
TH1F* tib3int;
TH1F* tib3ext;
TH1F* tib4int;
TH1F* tib4int;
TH1F* tib4ext;

std::string filename;
edm::EDGetTokenT<reco::TrackInfoCollection> trackCollectionToken;

};

TrackInfoAnalyzer::TrackInfoAnalyzer(const edm::ParameterSet& pset)
: filename(pset.getParameter<std::string>("OutFileName"))
, trackCollectionToken(consumes<reco::TrackInfoCollection>(pset.getParameter<edm::InputTag>("TrackInfo")))
{}


DEFINE_FWK_MODULE(TrackInfoAnalyzer);

Loading

0 comments on commit 575c0e6

Please sign in to comment.