Public Methods | |
XANAMcInfoTester () | |
~XANAMcInfoTester () | |
void | upDate (G3EventProxy *ev) |
Public Attributes | |
SimpleConfigurable< bool > | readPileup_ |
SimpleConfigurable< int > | minBunch_ |
SimpleConfigurable< int > | maxBunch_ |
SimpleConfigurable< bool > | readVertices_ |
|
Definition at line 33 of file XANAMcInfo.cpp. References maxBunch_, minBunch_, xana::out, readPileup_, and readVertices_.
00034 { 00035 xana::out(1) << "[update] Constructing an XANAMcInfoTester" << endl ; 00036 Observer<G3EventProxy *>::init() ; 00037 readPileup_=SimpleConfigurable<bool>(false,"HepG3EventProxyReader:ReadPileup"); 00038 minBunch_=SimpleConfigurable<int>(0,"HepG3EventProxyReader:MinBunch"); 00039 maxBunch_=SimpleConfigurable<int>(0,"HepG3EventProxyReader:MaxBunch"); 00040 readVertices_=SimpleConfigurable<bool>(false,"HepG3EventProxyReader:ReadVertices"); 00041 } |
|
Definition at line 43 of file XANAMcInfo.cpp.
00044 { 00045 } |
|
Definition at line 47 of file XANAMcInfo.cpp. References XANAGeantEvent::addGeantTrack, XANAGeantEvent::addGeantVertex, XANAGeantEvent::addGeneratorEvent, XANAGeneratorEvent::addPileupParticle, XANAGeneratorEvent::addSignalParticle, XANAGeantEvent::getGeneratorEvent, xana::out, XANAGeantEvent::print, XANAGeneratorEvent::print, and XANAGeantEvent::setGeneratorParticle.
00048 { 00049 00050 if (!ev) return ; 00051 00052 // first generator info 00053 vector<XANAGeneratorParticle> particles; 00054 00055 const RawHepEventParticle * aHepParticle; 00056 HepEventG3EventProxyReader EventReader(ev); 00057 RawHepEvent MyHepEvent; 00058 MyHepEvent.read(&EventReader); 00059 00060 xana::out(4) << std::endl; 00061 xana::out(4) << "[update] --- RawHepEvent ---" << std::endl; 00062 MyHepEvent.print(); 00063 xana::out(4) << std::endl << "[update] --- total event tree ---" << std::endl; 00064 MyHepEvent.printTree(); 00065 xana::out(4) << std::endl; 00066 00067 XANAGeneratorEvent *aMcEvent = new XANAGeneratorEvent; 00068 XANAGeneratorParticle *aMcParticle; 00069 // !! in RawHepEvent, i runs from 1 to n() !! 00070 for(unsigned int i=1; i<=MyHepEvent.n(); i++) { 00071 aHepParticle = MyHepEvent.getParticle(i); 00072 HepLorentzVector momentum(aHepParticle->px(), aHepParticle->py(), 00073 aHepParticle->pz(), aHepParticle->e()); 00074 aMcParticle = new XANAGeneratorParticle(aHepParticle->line(), aHepParticle->status(), 00075 aHepParticle->pid(), aHepParticle->mother1(), aHepParticle->mother2(), 00076 aHepParticle->daughter1(), aHepParticle->daughter2(), momentum, 00077 aHepParticle->mass(), aHepParticle->vertex()); 00078 // assuming signal particles are the first ones 00079 if (i<=MyHepEvent.nSignal()) { 00080 aMcEvent->addSignalParticle(aMcParticle); 00081 } else { 00082 aMcEvent->addPileupParticle(aMcParticle); 00083 } 00084 } 00085 00086 xana::out(4) << std::endl << "[update] --- XANAGeneratorEvent ---" << std::endl; 00087 aMcEvent->print(); 00088 xana::out(4) << std::endl; 00089 00090 // then Geant info 00091 00092 xana::out(4) << "[update] --- GEANT vertices -----------------------------------" << std::endl; 00093 SimEvent::vertex_container GeantVertices; // this is an STL vector 00094 00095 GeantVertices = ev->simSignal()->proxy()->vertices(); // get the vertex container 00096 xana::out(4) << "[update] This event has " << GeantVertices.size() << " GEANT vertices." <<std::endl; 00097 xana::out(4).setf(std::ios::fixed, std::ios::floatfield); 00098 xana::out(2) << "[update] The annihilation process took place at " 00099 << "x=" << std::setw(7) << std::setprecision(4) << GeantVertices[0].position().x() 00100 << ", y=" << std::setw(7) << std::setprecision(4) << GeantVertices[0].position().y() 00101 << ", z=" << std::setw(7) << std::setprecision(4) << GeantVertices[0].position().z() 00102 << std::endl; 00103 00104 xana::out(4) << "[update] --- GEANT tracks -----------------------------------" << std::endl; 00105 00106 SimEvent::track_container GeantTracks; // this is an STL vector 00107 00108 GeantTracks = ev->simSignal()->proxy()->tracks(); 00109 xana::out(4) << "[update] This event has " << GeantTracks.size() << " GEANT tracks." <<std::endl; 00110 xana::out(2) << "[update] The first track is:" << std::endl; 00111 xana::out(2) << GeantTracks[0] << std::endl; 00112 00113 SimEvent::genpart_container GenParts; 00114 GenParts = ev->simSignal()->proxy()->genparts(); 00115 if (! GeantTracks[0].noGenpart()) { 00116 int genpart = GeantTracks[0].genpartIndex(); 00117 xana::out(2) << "[update] This corresponds to generator particle "; 00118 xana::out(2) << genpart << std::endl; 00119 GenParts[genpart].print(); 00120 } 00121 if (! GeantTracks[0].noVertex()) { 00122 int vertex = GeantTracks[0].vertIndex(); 00123 xana::out(2) << "[update] This track comes from the Geant Vertex "; 00124 xana::out(2) << vertex << " at " << std::endl; 00125 xana::out(2) << "x=" << std::setw(7) << std::setprecision(4) << GeantVertices[vertex].position().x() 00126 << ", y=" << std::setw(7) << std::setprecision(4) << GeantVertices[vertex].position().y() 00127 << ", z=" << std::setw(7) << std::setprecision(4) << GeantVertices[vertex].position().z() 00128 << std::endl; 00129 } 00130 00131 XANAGeantEvent aGeantEvent; 00132 aGeantEvent.addGeneratorEvent(aMcEvent); 00133 XANAGeantVertex *vtx=0; 00134 XANAGeantTrack *trk=0; 00135 int vertex=0; 00136 00137 for(unsigned int it=0; it<GeantTracks.size(); it++) { 00138 xana::out(2) << "[update] Track:" << it << " is " << std::endl; 00139 xana::out(2) << GeantTracks[it] << std::endl; 00140 // decode mother-daughter relationship 00141 xana::out(2) << "[update] track momentum " << GeantTracks[it].momentum() << std::endl; 00142 HepLorentzVector mom(GeantTracks[it].momentum()); 00143 int mothindex = 0 ; 00144 if (mom.e() < 0.) { 00145 mothindex = (int)(-GeantTracks[it].momentum().e()) ; 00146 xana::out(2) << "[update] track has daughter " << mothindex << std::endl; 00147 double energy2 = mom.perp2(); 00148 double mass = HepPDT::theTable().getParticleData(GeantTracks[it].type())->mass(); 00149 energy2 += mass*mass ; 00150 double energy = sqrt(energy2) ; 00151 mom.setE(energy); 00152 } 00153 xana::out(2) << "[update] recomputed geant track momentum " << mom << std::endl; 00154 // now create XANA track 00155 trk = new XANAGeantTrack(it+1,GeantTracks[it].type(), mom, mothindex); 00156 if (! GeantTracks[it].noVertex()) { 00157 vertex = GeantTracks[it].vertIndex(); 00158 xana::out(2) << "[update] This track comes from the Geant Vertex "; 00159 xana::out(2) << vertex << " at " << std::endl; 00160 xana::out(2) << "x=" << std::setw(7) << std::setprecision(4) << GeantVertices[vertex].position().x() 00161 << ", y=" << std::setw(7) << std::setprecision(4) << GeantVertices[vertex].position().y() 00162 << ", z=" << std::setw(7) << std::setprecision(4) << GeantVertices[vertex].position().z() 00163 << endl; 00164 vtx = new XANAGeantVertex(GeantVertices[vertex].position()); 00165 aGeantEvent.addGeantVertex(vtx); 00166 aGeantEvent.addGeantTrack(trk, vtx); 00167 } else 00168 aGeantEvent.addGeantTrack(trk); 00169 00170 xana::out(2) << "[update] Now setting link to generator particle"<< std::endl; 00171 XANAGeneratorParticle *parent; 00172 if (! GeantTracks[it].noGenpart()) { 00173 int genpart = GeantTracks[it].genpartIndex(); 00174 xana::out(2) << "[update] This corresponds to generator particle "; 00175 xana::out(2) << genpart << std::endl; 00176 GenParts[genpart].print(); 00177 // create generator particle with available info 00178 parent = new XANAGeneratorParticle(genpart+1, GenParts[genpart].status(), 00179 GenParts[genpart].pid(), GenParts[genpart].mother1(), GenParts[genpart].mother2(), 00180 GenParts[genpart].daughter1(), GenParts[genpart].daughter2(), 00181 GenParts[genpart].fourmomentum(), 00182 0., GeantVertices[vertex].position()); 00183 aGeantEvent.setGeneratorParticle(trk, parent); 00184 } 00185 00186 } 00187 xana::out(4) << std::endl; 00188 xana::out(4) << "[update] Printing XANAGeantEvent "<< std::endl; 00189 aGeantEvent.print(); 00190 xana::out(4) << std::endl; 00191 xana::out(4) << "[update] Related generator event is "<< std::endl; 00192 aGeantEvent.getGeneratorEvent()->print(); 00193 xana::out(4) << std::endl; 00194 00195 } |
|
Definition at line 30 of file XANAMcInfo.cpp. Referenced by XANAMcInfoTester. |
|
Definition at line 29 of file XANAMcInfo.cpp. Referenced by XANAMcInfoTester. |
|
Definition at line 28 of file XANAMcInfo.cpp. Referenced by XANAMcInfoTester. |
|
Definition at line 31 of file XANAMcInfo.cpp. Referenced by XANAMcInfoTester. |