37 #include <Pythia8/Pythia.h> 42 #include "TLorentzVector.h" 67 std::map<int,TH1D*>
h_p;
68 std::map<int,TH1D*>
h_v;
103 pythia =
new Pythia8::Pythia();
118 for(
size_t i = 0;
i<
pids.size();++
i){
123 if(!pdt.isParticle(pid)){
124 std::cout <<
"ERROR: BAD PARTICLE, pythia is not aware of pid " << pid << std::endl;
127 Pythia8::ParticleDataEntry * pd = pdt.particleDataEntryPtr(pid);
130 double m0 = pd->m0();
131 double w = pd->mWidth();
134 mmin = m0 - m0/1000.;
135 mmax = m0 + m0/1000.;
141 std::stringstream strstr;
142 strstr <<
"mass_" <<
pid;
143 h_mass[
pid] =
new TH1D(strstr.str().c_str(),strstr.str().c_str(),100,mmin,mmax);
145 h_mass_ref[
pid]->SetTitle(h_mass_ref[pid]->GetName());
147 h_mass_ref[
pid]->Fill(m0);
149 for(
int b =1;
b<=h_mass_ref[
pid]->GetNbinsX();++
b){
150 double _val = h_mass_ref[
pid]->GetBinCenter(
b);
151 h_mass_ref[
pid]->SetBinContent(
b,TMath::BreitWigner(_val,m0,w));
157 strstr <<
"p_" <<
pid;
158 h_p[
pid] =
new TH1D(strstr.str().c_str(),strstr.str().c_str(),100,0,20);
162 strstr <<
"v_" <<
pid;
163 h_v[
pid] =
new TH1D(strstr.str().c_str(),strstr.str().c_str(),100,0,1.);
166 double ctau0 = pd->tau0()/10.;
168 strstr <<
"plt_" <<
pid;
169 h_plt[
pid] =
new TH1D(strstr.str().c_str(),strstr.str().c_str(),100,0,
std::min(5.*ctau0,500.));
171 h_plt_ref[
pid]->SetTitle(h_plt_ref[pid]->GetName());
172 for(
int b =1;
b<=h_plt_ref[
pid]->GetNbinsX();++
b){
173 double _val = h_plt_ref[
pid]->GetBinCenter(
b);
174 h_plt_ref[
pid]->SetBinContent(
b,TMath::Exp(-_val/ctau0));
180 strstr <<
"br_" <<
pid;
181 h_br[
pid] =
new TH1D(strstr.str().c_str(),strstr.str().c_str(),0,0,0);
182 h_br[
pid]->SetCanExtend(TH1::kAllAxes);
186 for(
int d = 0;
d<pd->sizeChannels();++
d){
187 Pythia8::DecayChannel & channel = pd->channel(
d);
188 std::vector<int>
prod;
189 for(
int p = 0;
p<channel.multiplicity();++
p){
190 int pId =
abs(channel.product(
p));
192 bool particleCut = ( pId > 10 && pId != 12 && pId != 14 &&
193 pId != 16 && pId != 18 && pId != 21 &&
194 (pId < 23 || pId > 40 ) &&
195 (pId < 81 || pId > 100 ) && pId != 2101 &&
196 pId != 3101 && pId != 3201 && pId != 1103 &&
197 pId != 2103 && pId != 2203 && pId != 3103 &&
198 pId != 3203 && pId != 3303 );
200 prod.push_back(
abs(channel.product(
p)));
202 std::sort(prod.begin(),prod.end());
204 for(
size_t p = 0;
p<prod.size();++
p){
205 strstr <<
"_" << prod[
p];
208 h_br[
pid]->Fill(label.c_str(),0.);
209 h_br_ref[
pid]->Fill(label.c_str(),channel.bRatio());
216 strstr <<
"originVertexRho_" <<
pid;
219 strstr <<
"originVertexZ_" <<
pid;
222 strstr <<
"decayVertexRho_" <<
pid;
225 strstr <<
"decayVertexZ_" <<
pid;
226 h_decayVertexZ[
pid] =
new TH1D(strstr.str().c_str(),strstr.str().c_str(),100,0,400);
237 TFile *
f = TFile::Open(
outputFile.c_str(),
"RECREATE");
239 f->mkdir(
"observed");
240 f->mkdir(
"prediction");
241 for(
size_t i = 0;
i<
pids.size();++
i){
276 iEvent.
getByLabel(
"famosSimHits",simvertices);
281 std::map<size_t,std::vector<size_t> > childMap;
282 std::map<size_t,int> parentMap;
283 for(
size_t j = 0;j<simtracks->size();j++){
284 childMap[j] = std::vector<size_t>();
289 for(
size_t j = 0;j<simtracks->size();j++){
290 size_t childIndex = j;
298 childMap[parentIndex].push_back(childIndex);
299 parentMap[childIndex] =
int(parentIndex);
303 for(
size_t j = 0;j<simtracks->size();j++){
322 if(childMap[j].
size() > 0){
331 for(
std::map<
size_t,std::vector<size_t> >::iterator it = childMap.begin();it != childMap.end();++it){
334 size_t parentIndex = it->first;
337 std::vector<size_t> & childIndices = it->second;
338 if(childIndices.size() == 0)
346 const SimTrack & child0 = simtracks->at(childIndices[0]);
351 TLorentzVector lv_dist = lv_decay_vertex - lv_origin_vertex;
353 TVector3
boost = lv_parent.BoostVector();
354 lv_dist.Boost(-boost);
355 h_v[
pid]->Fill(boost.Mag());
356 double plt = lv_dist.T();
360 std::vector<int>
prod;
361 for(
size_t d = 0;
d<childIndices.size();++
d){
362 prod.push_back(
abs(simtracks->at(childIndices[
d]).type()));
364 std::sort(prod.begin(),prod.end());
365 std::stringstream strstr;
366 for(
size_t p = 0;
p<prod.size();++
p){
367 strstr <<
"_" << prod[
p];
372 h_br[
pid]->Fill(label.c_str(),1.);
T getParameter(std::string const &) const
std::map< int, std::vector< std::string > > knownDecayModes
#define DEFINE_FWK_MODULE(type)
std::map< int, TH1D * > h_v
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
std::map< int, TH1D * > h_decayVertexZ
void addDefault(ParameterSetDescription const &psetDescription)
std::map< int, TH1D * > h_br_ref
std::map< int, TH1D * > h_plt_ref
std::map< int, TH1D * > h_decayVertexRho
std::map< int, TH1D * > h_originVertexZ
Abs< T >::type abs(const T &t)
const math::XYZTLorentzVectorD & position() const
HepPDT::ParticleData ParticleData
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
int vertIndex() const
index of the vertex in the Event container (-1 if no vertex)
std::map< int, TH1D * > h_plt
TestPythiaDecays(const edm::ParameterSet &)
int type() const
particle type (HEP PDT convension)
std::map< int, TH1D * > h_br
const math::XYZTLorentzVectorD & momentum() const
std::map< int, TH1D * > h_mass
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::map< int, TH1D * > h_p
std::map< int, TH1D * > h_mass_ref
std::map< int, TH1D * > h_originVertexRho