Public Member Functions | |
VertexTHA (const edm::ParameterSet &) | |
~VertexTHA () | |
Private Types | |
typedef std::pair< std::string, std::size_t > | counter_pair_t |
typedef std::map< std::string, std::size_t > | counter_t |
typedef std::set< int > | sint |
typedef std::vector< double > | vdouble |
typedef std::vector < edm::ParameterSet > | vParameterSet |
typedef std::vector< std::string > | vstring |
typedef std::vector< vstring > | vvstring |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
void | Count (const std::string &) |
virtual void | endJob () |
Private Attributes | |
counter_t | counter_ |
edm::ESHandle< ParticleDataTable > | pdt_ |
std::string | rootFile_ |
double | sourceCut_ |
std::size_t | totalTracks_ |
TrackHistory | tracer_ |
edm::InputTag | trackCollection_ |
vvstring | vetoList_ |
Definition at line 40 of file VertexTHA.cc.
typedef std::pair<std::string,std::size_t> VertexTHA::counter_pair_t [private] |
Definition at line 73 of file VertexTHA.cc.
typedef std::map<std::string,std::size_t> VertexTHA::counter_t [private] |
Definition at line 72 of file VertexTHA.cc.
typedef std::set<int> VertexTHA::sint [private] |
Definition at line 56 of file VertexTHA.cc.
typedef std::vector<double> VertexTHA::vdouble [private] |
Definition at line 57 of file VertexTHA.cc.
typedef std::vector<edm::ParameterSet> VertexTHA::vParameterSet [private] |
Definition at line 60 of file VertexTHA.cc.
typedef std::vector<std::string> VertexTHA::vstring [private] |
Definition at line 58 of file VertexTHA.cc.
typedef std::vector<vstring> VertexTHA::vvstring [private] |
Definition at line 59 of file VertexTHA.cc.
VertexTHA::VertexTHA | ( | const edm::ParameterSet & | config | ) | [explicit] |
Definition at line 85 of file VertexTHA.cc.
References edm::ParameterSet::getUntrackedParameter(), rootFile_, sourceCut_, and trackCollection_.
00085 : tracer_(config) 00086 { 00087 trackCollection_ = config.getUntrackedParameter<edm::InputTag> ( "trackProducer" ); 00088 00089 rootFile_ = config.getUntrackedParameter<std::string> ( "rootFile" ); 00090 00091 sourceCut_ = config.getUntrackedParameter<double> ( "sourceCut" ); 00092 }
VertexTHA::~VertexTHA | ( | ) |
void VertexTHA::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | setup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 96 of file VertexTHA.cc.
References Count(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), TrackHistory::evaluate(), index, j, TrackHistory::newEvent(), gen_jpsi2muons_cfg::ParticleID, pdt_, TrackHistory::simVertexTrail(), edm::RefVector< C, T, F >::size(), tracer_, trackCollection_, and tracks.
00097 { 00098 // Track collection 00099 edm::Handle<edm::View<reco::Track> > trackCollection; 00100 event.getByLabel(trackCollection_, trackCollection); 00101 00102 // Set the tracer for a new event 00103 tracer_.newEvent(event, setup); 00104 00105 // Loop over the track collection. 00106 for (std::size_t index = 0; index < trackCollection->size(); index++) 00107 { 00108 // If the track is not fake then get the vertexes 00109 if ( tracer_.evaluate( edm::RefToBase<reco::Track>(trackCollection, index) ) ) 00110 { 00111 // Get the list of TrackingVertexes associated to 00112 TrackHistory::SimVertexTrail vertexes(tracer_.simVertexTrail()); 00113 00114 // Loop over all vertexes 00115 if ( !vertexes.empty() ) 00116 { 00117 // create a description of the vertex 00118 std::ostringstream vDescription; 00119 00120 TrackingParticleRefVector tracks(vertexes[0]->sourceTracks()); 00121 std::size_t nTracks = tracks.size(); 00122 ParticleData const * pid; 00123 00124 for (std::size_t j = 0; j < nTracks; j++) 00125 { 00126 if (!j) vDescription << "("; 00127 00128 HepPDT::ParticleID particleType(tracks[j]->pdgId()); 00129 00130 if (particleType.isValid()) 00131 { 00132 pid = pdt_->particle(particleType); 00133 if (pid) 00134 vDescription << pid->name(); 00135 else 00136 vDescription << '*'; 00137 } 00138 else 00139 vDescription << '*'; 00140 00141 if (j == nTracks - 1) vDescription << ")"; 00142 else vDescription << ","; 00143 } 00144 00145 vDescription << "->"; 00146 00147 tracks = vertexes[0]->daughterTracks(); 00148 nTracks = tracks.size(); 00149 00150 for (std::size_t j = 0; j < nTracks; j++) 00151 { 00152 if (!j) vDescription << "("; 00153 00154 HepPDT::ParticleID particleType(tracks[j]->pdgId()); 00155 00156 if (particleType.isValid()) 00157 { 00158 pid = pdt_->particle(particleType); 00159 if (pid) 00160 vDescription << pid->name(); 00161 else 00162 vDescription << '*'; 00163 } 00164 else 00165 vDescription << '*'; 00166 00167 if (j == nTracks - 1) vDescription << ")"; 00168 else vDescription << ","; 00169 } 00170 00171 vDescription << '#' << vertexes.size(); 00172 std::cout << "Found associated vertex : " << vDescription.str() << std::endl; 00173 00174 // count the the vertex. 00175 Count(vDescription.str()); 00176 } 00177 else 00178 Count(std::string("WithoutTrackingVertexes")); 00179 } 00180 else 00181 Count(std::string("Fake")); 00182 } 00183 }
void VertexTHA::beginJob | ( | const edm::EventSetup & | setup | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 187 of file VertexTHA.cc.
References edm::EventSetup::getData(), pdt_, and totalTracks_.
00188 { 00189 // Get the particles table. 00190 setup.getData( pdt_ ); 00191 00192 totalTracks_ = 0; 00193 }
void VertexTHA::Count | ( | const std::string & | vDescription | ) | [private] |
Definition at line 275 of file VertexTHA.cc.
References counter_, it, and totalTracks_.
Referenced by analyze().
00276 { 00277 counter_t::iterator it = counter_.find(vDescription); 00278 00279 if ( it != counter_.end() ) 00280 it->second++; 00281 else 00282 counter_.insert( counter_pair_t(vDescription, 1) ); 00283 00284 totalTracks_++; 00285 }
Reimplemented from edm::EDAnalyzer.
Definition at line 197 of file VertexTHA.cc.
References counter_, GenMuonPlsPt100GeV_cfg::cout, EgammaValidation_Zee_cff::cut, lat::endl(), error, file, i, if(), it, rootFile_, sourceCut_, funct::sqrt(), and totalTracks_.
00198 { 00199 TFile file(rootFile_.c_str(), "RECREATE"); 00200 file.cd(); 00201 00202 std::cout << "List of all found vertexes" << std::endl; 00203 for ( counter_t::iterator it = counter_.begin(); it != counter_.end(); it++) 00204 std::cout << " Vertex " << it->first << " -> " << it->second << " tracks" << std::endl; 00205 00206 std::multimap<double, std::string> vDescriptions; 00207 00208 double cut; 00209 00210 for (counter_t::iterator it = counter_.begin(); it != counter_.end(); it++) 00211 { 00212 cut = (double) it->second/totalTracks_; 00213 if (cut > sourceCut_) 00214 vDescriptions.insert(std::pair<double,std::string>(cut, it->first)); 00215 } 00216 00217 std::ostringstream hName, hTitle; 00218 00219 hTitle << "TrackingVertexes that originate whole track collection"; 00220 hName << "vertexTrackHistory"; 00221 00222 // creating and saving the pie 00223 TH1D histogram( 00224 hName.str().c_str(), 00225 hTitle.str().c_str(), 00226 vDescriptions.size(), 00227 0., 00228 Double_t(vDescriptions.size()) 00229 ); 00230 00231 // creating and saving the pie 00232 TH1D histogram_plus_error( 00233 (hName.str()+std::string("_plus_error")).c_str(), 00234 hTitle.str().c_str(), 00235 vDescriptions.size(), 00236 0., 00237 Double_t(vDescriptions.size()) 00238 ); 00239 00240 // creating and saving the pie 00241 TH1D histogram_minus_error( 00242 (hName.str()+std::string("_minus_error")).c_str(), 00243 hTitle.str().c_str(), 00244 vDescriptions.size(), 00245 0., 00246 Double_t(vDescriptions.size()) 00247 ); 00248 00249 int i = 1; 00250 double error; 00251 00252 std::map<double, std::string>::iterator it; 00253 for (it = vDescriptions.begin(); it != vDescriptions.end(); it++, i++) 00254 { 00255 error = sqrt(it->first*(1 - it->first)/totalTracks_); 00256 00257 histogram.GetXaxis()->SetBinLabel(i, it->second.c_str()); 00258 histogram.SetBinContent(i, Double_t(it->first)); 00259 histogram.SetBinError(i, Double_t(error)); 00260 00261 histogram_plus_error.GetXaxis()->SetBinLabel(i, it->second.c_str()); 00262 histogram_plus_error.SetBinContent(i, Double_t(it->first+error)); 00263 00264 histogram_minus_error.GetXaxis()->SetBinLabel(i, it->second.c_str()); 00265 histogram_minus_error.SetBinContent(i, Double_t(it->first-error)); 00266 } 00267 00268 histogram.Write(); 00269 histogram_plus_error.Write(); 00270 histogram_minus_error.Write(); 00271 00272 file.Flush(); 00273 }
counter_t VertexTHA::counter_ [private] |
edm::ESHandle<ParticleDataTable> VertexTHA::pdt_ [private] |
std::string VertexTHA::rootFile_ [private] |
double VertexTHA::sourceCut_ [private] |
std::size_t VertexTHA::totalTracks_ [private] |
TrackHistory VertexTHA::tracer_ [private] |
edm::InputTag VertexTHA::trackCollection_ [private] |
vvstring VertexTHA::vetoList_ [private] |
Definition at line 66 of file VertexTHA.cc.