1 #define HBT_BFIELD 0.25*tesla
2 #define DIFF_CUT_OFF 1.
4 #include "StHbtMaker/Reader/StHbtMcEventReader.h"
8 #include "StEventTypes.h"
9 #include "StEventMaker/StEventMaker.h"
11 #include "StMcEventTypes.hh"
12 #include "StMcEventMaker/StMcEventMaker.h"
19 #include "SystemOfUnits.h"
20 #include "StHbtMaker/Infrastructure/StHbtTrackCollection.hh"
21 #include "StHbtMaker/Infrastructure/StHbtV0Collection.hh"
28 #include "PhysicalConstants.h"
29 #include "SystemOfUnits.h"
30 #include "StThreeVector.hh"
31 #include "phys_constants.h"
34 #include "St_DataSet.h"
35 #include "St_DataSetIter.h"
37 #include "g2t_event.h"
38 #include "g2t_ftp_hit.h"
39 #include "g2t_svt_hit.h"
40 #include "g2t_tpc_hit.h"
41 #include "g2t_track.h"
42 #include "g2t_vertex.h"
44 #include "tables/St_g2t_event_Table.h"
45 #include "tables/St_g2t_ftp_hit_Table.h"
46 #include "tables/St_g2t_svt_hit_Table.h"
47 #include "tables/St_g2t_tpc_hit_Table.h"
48 #include "tables/St_g2t_track_Table.h"
49 #include "tables/St_g2t_vertex_Table.h"
51 #include "StMcEvent.hh"
52 #include "StMcTrack.hh"
53 #include "StMcTpcHit.hh"
54 #include "StMcFtpcHit.hh"
55 #include "StMcSvtHit.hh"
56 #include "StMcVertex.hh"
58 #include "StParticleDefinition.hh"
59 #include "StKaonZeroShort.hh"
60 #include "StLambda.hh"
61 #include "StAntiLambda.hh"
62 #include "StPhysicalHelix.hh"
70 #ifndef ST_NO_NAMESPACES
71 using namespace units;
74 #define __2POWER16__ 65536
80 double dedxMean(
double mass,
double momentum){
82 double tpcDedxGain = 0.174325e-06;
83 double tpcDedxOffset = -2.71889;
84 double tpcDedxRise = 776.626;
86 double gamma = ::sqrt(::pow(momentum/mass,2)+1.);
87 double beta = ::sqrt(1. - 1./::pow(gamma,2));
88 double rise = tpcDedxRise*::pow(beta*gamma,2);
90 dedxMean = tpcDedxGain/::pow(beta,2) * (0.5*::log(rise)-::pow(beta,2)- tpcDedxOffset);
97 StHbtMcEventReader::StHbtMcEventReader(){
104 mMotherMinvYPt =
new StHbt3DHisto(
"Mother_MinvYPt",
"Mother_MinvYPt", 100,0.,5., 80,-2.,2., 80,0.,4.);
105 mMotherMinvYMt =
new StHbt3DHisto(
"Mother_MinvYMt",
"Mother_MinvYMt", 100,0.,5., 80,-2.,2., 80,0.,4.);
106 mMotherMinvEtaPt =
new StHbt3DHisto(
"Mother_MinvEtaPt",
"Mother_MinvEtaPt",100,0.,5., 80,-2.,2., 80,0.,4.);
109 StHbtMcEventReader::~StHbtMcEventReader(){
110 if (mEventCut)
delete mEventCut;
111 if (mTrackCut)
delete mTrackCut;
112 if (mV0Cut)
delete mV0Cut;
115 StHbtString StHbtMcEventReader::Report(){
116 StHbtString temp =
"\n This is the StHbtMcEventReader\n";
117 temp +=
"---> EventCuts in Reader: ";
119 temp += mEventCut->Report();
124 temp +=
"\n---> TrackCuts in Reader: ";
126 temp += mTrackCut->Report();
131 temp +=
"\n---> V0Cuts in Reader: ";
133 temp += mV0Cut->Report();
142 StHbtEvent* StHbtMcEventReader::ReturnHbtEvent(){
143 cout <<
" **************************************************************************************" << endl;
144 cout <<
" StHbtMcEventReader::ReturnHbtEvent() : Seconds elapsed since last call : " << difftime( time(0), timeStamp ) << endl;
145 cout <<
" **************************************************************************************" << endl;
157 mcEvent = (
StMcEvent*) StMaker::GetChain()->GetDataSet(
"StMcEvent");
160 cout <<
"StHbtMcEventReader - No StMcEvent!!! " << endl;
169 unsigned long EventNumber = mcEvent->eventNumber();
171 int Mult = mcEvent->tracks().size();
178 if (VertexPosition.x() == VertexPosition.y() &&
179 VertexPosition.y() == VertexPosition.z() ){
180 cout <<
"StHbtMcEventReader - bad vertex !!! " << endl;
186 hbtEvent->SetEventNumber(EventNumber);
187 hbtEvent->SetCtbMult(0);
188 hbtEvent->SetZdcAdcEast(0);
189 hbtEvent->SetZdcAdcWest(0);
190 hbtEvent->SetNumberOfTpcHits(0);
191 hbtEvent->SetNumberOfTracks(Mult);
192 hbtEvent->SetNumberOfGoodTracks(Mult);
193 hbtEvent->SetReactionPlane(0.);
194 hbtEvent->SetReactionPlaneSubEventDifference(0.);
195 hbtEvent->SetPrimVertPos(VertexPosition);
209 for (StMcTrackIterator iter=mcEvent->tracks().begin(); iter!=mcEvent->tracks().end(); iter++){
213 if (track->particleDefinition()) {
214 if (CheckPdgIdList(mAcceptedMothers,track->particleDefinition()->pdgEncoding())) {
215 mMotherMinvYPt->Fill(track->fourMomentum().m(),track->rapidity(),track->pt());
216 mMotherMinvYMt->Fill(track->fourMomentum().m(),track->rapidity(),track->fourMomentum().mt());
217 mMotherMinvEtaPt->Fill(track->fourMomentum().m(),track->pseudoRapidity(),track->pt());
224 int motherPdgCode = 0;
225 int daughterPdgCode = 0;
226 int motherTrackId = 0;
227 if (CheckPdgIdLists()) {
229 if (!track->particleDefinition()) {
230 cout <<
" track has no particle definiton " << endl;
233 pdgCode = track->particleDefinition()->pdgEncoding();
235 if (track->parent()) {
236 motherPdgCode = track->parent()->pdgId();
237 motherTrackId = track->parent()->key();
239 if (motherPdgCode==333) cout <<
" phi 333" << endl;
241 if ( track->stopVertex() == 0 ) {
242 check += CheckPdgIdList(pdgCode,motherPdgCode,0);
246 for (
unsigned int iDaughter=0; iDaughter < track->stopVertex()->daughters().size()-1; iDaughter++) {
247 daughterPdgCode = track->stopVertex()->daughters()[iDaughter]->pdgId();
248 check += CheckPdgIdList(pdgCode,motherPdgCode,daughterPdgCode);
258 int nTpcHits = track->tpcHits().size();
272 #ifdef TheWorldIsNice
273 hbtTrack->SetP( track->momentum() );
276 tmpP.setX( track->momentum().x() );
277 tmpP.setY( track->momentum().y() );
278 tmpP.setZ( track->momentum().z() );
279 hbtTrack->SetP( tmpP );
283 hbtTrack->SetTrackId(track->key()+motherTrackId*__2POWER16__);
285 hbtTrack->SetNHits( nTpcHits );
286 hbtTrack->SetNHitsPossible(nTpcHits );
292 int geantPid = track->particleDefinition()->pdgEncoding();
298 hbtTrack->SetNSigmaElectron(0.);
299 hbtTrack->SetNSigmaPion(-999.);
300 hbtTrack->SetNSigmaKaon(-999.);
301 hbtTrack->SetNSigmaProton(-999.);
305 hbtTrack->SetNSigmaElectron(999.);
306 hbtTrack->SetNSigmaPion(0.);
307 hbtTrack->SetNSigmaKaon(-999.);
308 hbtTrack->SetNSigmaProton(-999.);
312 hbtTrack->SetNSigmaElectron(999.);
313 hbtTrack->SetNSigmaPion(999.0);
314 hbtTrack->SetNSigmaKaon(0.);
315 hbtTrack->SetNSigmaProton(-999.);
319 hbtTrack->SetNSigmaElectron(999.);
320 hbtTrack->SetNSigmaPion(999.);
321 hbtTrack->SetNSigmaKaon(999.);
322 hbtTrack->SetNSigmaProton(0.);
325 hbtTrack->SetNSigmaElectron(999.);
326 hbtTrack->SetNSigmaPion(999.);
327 hbtTrack->SetNSigmaKaon(999.);
328 hbtTrack->SetNSigmaProton(999.);
335 hbtTrack->SetdEdx( dedxMean( track->particleDefinition()->mass(), track->momentum().mag() ) );
338 hbtTrack->SetPt( track->momentum().perp() );
341 hbtTrack->SetCharge( (
int)(track->particleDefinition()->charge()) );
344 #ifdef TheWorldIsNice
348 tmpSV.setX( track->startVertex()->position().x() );
349 tmpSV.setY( track->startVertex()->position().y() );
350 tmpSV.setZ( track->startVertex()->position().z() );
354 hbtTrack->SetHelix(helix);
357 double pathlength = helix.
pathLength(VertexPosition);
362 hbtTrack->SetDCAxy( DCAxyz.perp() );
363 hbtTrack->SetDCAz( DCAxyz.z() );
365 hbtTrack->SetChiSquaredXY( 0.);
366 hbtTrack->SetChiSquaredZ( 0.);
373 if (!(mTrackCut->Pass(hbtTrack))){
378 hbtEvent->TrackCollection()->push_back(hbtTrack);
380 cout << hbtEvent->TrackCollection()->size() <<
" tracks pushed to collection" << endl;
386 StLambda* lambda = StLambda::instance();
388 for (StMcVertexIterator vIter=mcEvent->vertices().begin(); vIter!=mcEvent->vertices().end(); vIter++){
392 if ( parent->particleDefinition() == k0Short ||
393 parent->particleDefinition() == lambda ||
394 parent->particleDefinition() == antiLambda &&
395 vertex->numberOfDaughters() == 2) {
397 cout <<
" v0 Id : " << parent->particleDefinition()->name() << endl;
401 if ( (*(vertex->daughters().begin()))->particleDefinition()->charge() > 0 ) {
402 pos = *(vertex->daughters().begin());
403 neg = *(vertex->daughters().end()-1);
405 else if ( (*(vertex->daughters().begin()))->particleDefinition()->charge() < 0 ) {
406 neg = *(vertex->daughters().begin());
407 pos = *(vertex->daughters().end()-1);
413 hbtv0->SetdecayLengthV0( abs(vertex->position()-VertexPosition) );
414 hbtv0->SetdecayVertexV0( vertex->position() );
417 HBT_BFIELD, pos->particleDefinition()->charge() );
419 HBT_BFIELD, neg->particleDefinition()->charge() );
423 double posPathLength = posHelix.
pathLength( vertex->position() );
424 double negPathLength = negHelix.pathLength( vertex->position() );
426 hbtv0->SetdcaV0Daughters( abs(posHelix.at(posPathLength)-negHelix.at(negPathLength)) );
429 hbtv0->SetdcaV0ToPrimVertex( v0Helix.distance( VertexPosition ) );
432 hbtv0->SetdcaPosToPrimVertex( posHelix.
distance( VertexPosition ) );
433 hbtv0->SetdcaNegToPrimVertex( negHelix.distance( VertexPosition ) );
435 hbtv0->SetmomPos( pos->momentum() );
436 hbtv0->SetmomNeg( neg->momentum() );
438 hbtv0->SettpcHitsPos( pos->tpcHits().size() );
439 hbtv0->SettpcHitsNeg( neg->tpcHits().size() );
446 hbtv0->SetkeyPos(pos->key());
447 hbtv0->SetkeyNeg(neg->key());
453 if (!(mV0Cut->Pass(hbtv0))){
459 hbtEvent->V0Collection()->push_back(hbtv0);
463 cout << hbtEvent->V0Collection()->size() <<
" v0s pushed to collection" << endl;
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
double distance(const StThreeVector< double > &p, bool scanPeriods=true) const
minimal distance between point and helix
pair< double, double > pathLength(double r) const
path length at given r (cylindrical r)
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...