66 #include "TStopwatch.h"
67 #include "TApplication.h"
69 #include "TEveManager.h"
70 #include "TEveScene.h"
71 #include "TEveElement.h"
73 #include "TEvePointSet.h"
74 #include "TEveQuadSet.h"
75 #include "TEveViewer.h"
77 #include "TEveTrackPropagator.h"
78 #include "TEveTrack.h"
79 #include "TEveVSDStructs.h"
83 #include "TGLViewer.h"
84 #include "TGLSAViewer.h"
87 #include "TGNumberEntry.h"
88 #include "TGButtonGroup.h"
89 #include "TGNumberEntry.h"
184 gEDEvtNavHandler =
this;
195 vertexlist =
new TEveElementList(
"vertex",
"vertex");
196 sectors =
new HEDGroup (
"sectors" ,
"sectors" ,6 ,
"Sector");
197 particlecandNoLep =
new HEDGroup (
"particlecandNoLep" ,
"particlecandNoLep" ,6 ,
"particlecandNoLep");
198 particlecandLep =
new HEDGroup (
"particlecandLep" ,
"particlecandLep" ,6 ,
"particlecandLep");
199 particlecandHad =
new HEDGroup (
"particlecandHad" ,
"particlecandHad" ,6 ,
"particlecandHad");
200 richpadplane =
new HEDGroup (
"richpadplane" ,
"richpadplane" ,6 ,
"richpadplane");
201 richpadplanecleaned =
new HEDGroup (
"richpadplanecleaned",
"richpadplanecleaned",6 ,
"richpadplanecleaned");
202 richhitpadplane =
new HEDGroup (
"richhitpadplane" ,
"richhitpadplane" ,6 ,
"richhitpadplane");
203 allMdcWires =
new HEDGroup2D (
"allMdcwires" ,
"allMdcwires" ,6,4,
"Sector",
"Module");
204 allMdcWiresNotUsed =
new HEDGroup2D (
"allMdcwiresNotUsed" ,
"allMdcwiresNotUsed" ,6,4,
"Sector",
"Module");
206 tofClusters =
new HEDGroup (
"tofclusters" ,
"tofclusters" ,6,
"tofclusters");
207 rpcClusters =
new HEDGroup (
"rpcclusters" ,
"rpcclusters" ,6,
"rpcclusters");
208 showerHits =
new HEDGroup (
"showerHits" ,
"showerHits" ,6,
"showerHits");
209 emcClusters =
new HEDGroup (
"emcClusters" ,
"emcClusters" ,6,
"emcClusters");
210 mdcSegments =
new HEDGroup (
"mdcSegments" ,
"mdcSegments" ,6,
"mdcSegments");
211 wallHits =
new TEveElementList(
"wallHits" ,
"wallHits");
212 wallPlane =
new TEveElementList(
"wallPane" ,
"wallPlane");
244 geantList =
new TEveElementList(
"Geant",
"Geant");
245 primList =
new TEveElementList(
"Primaries",
"Primaries");
246 secoList =
new TEveElementList(
"Secondaries",
"Secondaries");
248 simTrackList =
new TEveTrackList();
249 TEveTrackPropagator* prop = simTrackList->GetPropagator();
250 prop->SetFitDaughters(kTRUE);
251 prop->SetRnrDaughters(kTRUE);
252 prop->SetFitReferences(kTRUE);
253 prop->SetRnrReferences(kTRUE);
254 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
261 (prop->RefPMAtt()).SetMarkerStyle(20);
262 (prop->RefPMAtt()).SetMarkerColor(kRed);
263 (prop->RefPMAtt()).SetMarkerSize(1.0);
265 simTrackList->SetName(
"RK Propagator");
266 simTrackList->SetLineColor(kMagenta);
270 simTrackListPrim =
new TEveTrackList();
271 simTrackListPrim->SetName(
"others");
272 simTrackListPrim->SetLineColor(kMagenta);
274 simTrackListSeco =
new TEveTrackList();
275 simTrackListSeco->SetName(
"others");
276 simTrackListSeco->SetLineColor(kMagenta);
279 Int_t pidPrim[] = {2,3, 7,8,9, 10,11,12,16, 13,14};
280 for(UInt_t i = 0; i<
sizeof(pidPrim)/
sizeof(Int_t); i++){
284 Int_t pidSeco[] = {1, 2,3, 5,6, 7,8,9, 10,11,12,16, 13,14, 45,46};
286 for(UInt_t i = 0; i <
sizeof(pidSeco)/
sizeof(Int_t); i++){
291 geantRichList =
new TEveElementList(
"geantRich" ,
"geantRich");
292 geantRichDirectList =
new TEveElementList(
"geantDirectRich",
"geantDirectRich");
299 TEveScene* eveEv = gEve->GetEventScene();
305 Bool_t sectorsTopLevel = kFALSE;
307 gEve->AddElement(vertexlist ,eveEv);
309 if(sectorsTopLevel) {
310 gEve->AddElement(sectors ,eveEv);
312 for(Int_t s = 0;s < 6; s ++){
313 sectors->
getList(s)->AddElement(particlecandLep ->getList(s));
314 sectors->
getList(s)->AddElement(particlecandNoLep ->getList(s));
315 sectors->
getList(s)->AddElement(particlecandHad ->getList(s));
316 sectors->
getList(s)->AddElement(richpadplane ->getList(s));
317 sectors->
getList(s)->AddElement(richpadplanecleaned ->getList(s));
318 sectors->
getList(s)->AddElement(richhitpadplane ->getList(s));
321 gEve->AddElement(particlecandLep ,eveEv);
322 gEve->AddElement(particlecandNoLep ,eveEv);
323 gEve->AddElement(particlecandHad ,eveEv);
324 gEve->AddElement(richpadplane ,eveEv);
325 gEve->AddElement(richpadplanecleaned ,eveEv);
326 gEve->AddElement(richhitpadplane ,eveEv);
328 gEve->AddElement(allMdcWires ,eveEv);
329 gEve->AddElement(allMdcWiresNotUsed,eveEv);
330 allMdcWires ->SetRnrSelfChildren(kFALSE,kFALSE);
331 allMdcWiresNotUsed->SetRnrSelfChildren(kFALSE,kFALSE);
334 gEve->AddElement(rpcClusters ,eveEv);
336 else gEve->AddElement(emcClusters ,eveEv);
337 gEve->AddElement(mdcSegments ,eveEv);
338 gEve->AddElement(wallHits ,eveEv);
339 gEve->AddElement(wallPlane ,eveEv);
340 tofClusters->SetRnrSelfChildren(kFALSE,kFALSE);
341 rpcClusters->SetRnrSelfChildren(kFALSE,kFALSE);
342 showerHits->SetRnrSelfChildren(kFALSE,kFALSE);
343 emcClusters->SetRnrSelfChildren(kFALSE,kFALSE);
344 mdcSegments->SetRnrSelfChildren(kFALSE,kFALSE);
350 gEve->AddElement(primList,geantList);
351 gEve->AddElement(secoList,geantList);
354 for(UInt_t i = 0; i <
sizeof(pidPrim)/
sizeof(Int_t); i++){
355 gEve->AddElement(mapPrim[pidPrim[i]] ,primList);
357 gEve->AddElement(simTrackListPrim,primList);
360 for(UInt_t i = 0; i <
sizeof(pidSeco)/
sizeof(Int_t); i++){
361 gEve->AddElement(mapSeco[pidSeco[i]] ,secoList);
363 gEve->AddElement(simTrackListSeco,secoList);
365 mapPrim[13]->SetRnrSelfChildren(kFALSE,kFALSE);
367 gEve->AddElement(geantRichList ,eveEv);
368 gEve->AddElement(geantRichDirectList,eveEv);
377 if(gEDEvtNavHandler == 0){
380 return gEDEvtNavHandler;
420 Bool_t drawParticleCand = kTRUE;
421 Bool_t drawRichPadPlane = kTRUE;
422 Bool_t drawRichCompound = kTRUE;
423 Bool_t drawMdcWires = kTRUE;
424 Bool_t drawKine = kTRUE;
426 Bool_t drawTofClusters = kTRUE;
427 Bool_t drawRpcClusters = kTRUE;
428 Bool_t drawShowerHits = kTRUE;
429 Bool_t drawEmcClusters = kTRUE;
430 Bool_t drawMdcSegments = kTRUE;
431 Bool_t drawWallHits = kTRUE;
432 Bool_t drawWallPlane = kTRUE;
434 Bool_t savePics = kFALSE;
435 TString picturepath =
"./auto_pics";
436 TString picturemask =
"event_%i.png";
441 TEveScene* eveEv = gEve->GetEventScene();
449 vertexlist ->DestroyElements();
463 wallHits ->DestroyElements();
464 wallPlane ->DestroyElements();
470 map<Int_t,TEveTrackList*>::iterator iter;
471 for( iter = mapPrim.begin(); iter != mapPrim.end(); ++iter ) {
472 iter->second->DestroyElements();
474 simTrackListPrim->DestroyElements();
476 for( iter = mapSeco.begin(); iter != mapSeco.end(); ++iter ) {
477 iter->second->DestroyElements();
479 simTrackListSeco->DestroyElements();
482 geantRichList ->DestroyElements();
483 geantRichDirectList->DestroyElements();
498 Bool_t isSimulation = kFALSE;
499 Bool_t badEvent = kTRUE;
501 Int_t nCandLepBest = -1;
503 Int_t nCandHadBest = -1;
511 while (badEvent==kTRUE){
545 if(kineCat) isSimulation = kTRUE;
559 for(Int_t s = 0 ; s < 6; s ++){
567 if(drawRichCompound && richHitCat){
570 Int_t size = richHitCat->getEntries();
572 cout<<
"-----------------------------------------------------------------"<<endl;
573 cout<<
"reconstruted RICH Hits :"<<endl;
575 for(Int_t i = 0; i < size; i ++){
583 if(richhit->
getRadius() < 0) edrichcompound ->SetLineStyle(7);
584 richhitpadplane->
AddElement(s,edrichcompound);
585 Int_t tracks[3] = {-1,-1,-1};
586 Int_t weight[3] = {-1,-1,-1};
589 tracks[0] = richhit->
track1;
590 tracks[1] = richhit->
track2;
591 tracks[2] = richhit->
track3;
598 cout<<
"index "<<i<<
" sector "<<s<<
" ("<<setw(3)<<right<<tracks[0]<<
","<<weight[0] <<
") ("<<setw(3)<<right<<tracks[1]<<
","<<weight[1]<<
") ("<<setw(3)<<right<<tracks[2]<<
","<<weight[2]<<
")"<<endl;
602 cout<<
"-----------------------------------------------------------------"<<endl;
608 if(drawMdcWires && mdcCal1Cat){
612 Int_t size = mdcCal1Cat->getEntries();
616 for(Int_t i = 0; i < size; i ++){
627 if(ntimes == 1) edmdcwire ->SetLineColor(kBlue);
628 if(ntimes > 1 ) edmdcwire ->SetLineColor(kMagenta);
633 edmdcwire ->SetLineColor(kOrange);
634 allMdcWiresNotUsed->
AddElement(s,m,edmdcwire);
642 if(drawTofClusters && tofClustCat){
645 Int_t size = tofClustCat->getEntries();
647 for(Int_t i = 0; i < size; i ++){
659 if(drawRpcClusters && rpcClustCat){
662 Int_t size = rpcClustCat->getEntries();
664 for(Int_t i = 0; i < size; i ++){
676 if(drawShowerHits && showerHitCat){
679 Int_t size = showerHitCat->getEntries();
681 for(Int_t i = 0; i < size; i ++){
693 if(drawEmcClusters && emcClusterCat){
696 Int_t size = emcClusterCat->getEntries();
698 for(Int_t i = 0; i < size; i ++){
710 if(drawWallHits && wallHitCat){
713 Int_t size = wallHitCat->getEntries();
715 for(Int_t i = 0; i < size; i ++){
720 wallHits->AddElement(edwallhit);
733 if(drawMdcSegments && mdcSegCat){
736 Int_t size = mdcSegCat->getEntries();
738 for(Int_t i = 0; i < size; i ++){
751 if(drawParticleCand && particleCandCat){
754 Int_t size = particleCandCat->getEntries();
755 for(Int_t i = 0; i < size; i ++){
817 Bool_t doSelectSecondaries=kFALSE;
818 Float_t vertexDistCat = 500;
820 if(drawKine && kineCat){
822 Int_t size = kineCat->getEntries();
823 for(Int_t i = 0; i < size; i ++){
826 Int_t
id = kine->
getID();
833 if(sqrt(vx*vx+vy*vy+vz*vz)>vertexDistCat)
continue;
837 if(pz<pzCut)
continue;
842 track->SetLineColor(simTrackList->GetLineColor());
843 track->SetLineColor(simTrackList->GetLineColor());
846 track->SetLineWidth(2);
852 map<Int_t,TEveTrackList*>::iterator iter;
853 iter = mapSeco.find(
id);
855 if(iter != mapSeco.end()) iter->second->AddElement(track);
856 else simTrackListSeco->AddElement(track);
860 map<Int_t,TEveTrackList*>::iterator iter;
861 iter = mapPrim.find(
id);
863 if(iter != mapPrim.end()) iter->second->AddElement(track);
864 else simTrackListPrim->AddElement(track);
871 richGea->SetMarkerColor(kYellow);
872 richGea->SetMarkerSize(0.2);
873 geantRichList->AddElement(richGea);
879 if(geantRichDirectCat){
882 Int_t size = geantRichDirectCat->getEntries();
883 for(Int_t i = 0; i < size; i ++){
887 richGea->SetMarkerColor(kCyan+1);
888 richGea->SetMarkerStyle(kPlus);
889 richGea->SetMarkerSize(0.2);
890 geantRichDirectList->AddElement(richGea);
894 if(geantRichMirrorCat){
896 Int_t size = geantRichMirrorCat->getEntries();
897 for(Int_t i = 0; i < size; i ++){
901 richMir->SetMarkerColor(kMagenta);
902 geantRichList->AddElement(richMir);
911 cout<<
"-----------------------------------------------------------------"<<endl;
912 cout<<
"EventRun Number : "<<runNumber<<endl;
913 cout<<
"EventSeq Number : "<<seqNumber<<endl;
914 cout<<
"Vertex [cm] = "<<pVertex.
X()<<
", "<<pVertex.
Y()<<
", "<<pVertex.
Z()<<endl;
915 if(richHitCat) { cout<<setw(5)<<richHitCat->getEntries() <<
" RICH HITS " <<endl; }
916 if(mdcSegCat) { cout<<setw(5)<<mdcSegCat->getEntries() <<
" MDC SEGMENTS "<<endl; }
917 if(tofHitCat) { cout<<setw(5)<<tofHitCat->getEntries() <<
" TOF HITS " <<endl; }
918 if(tofClustCat) { cout<<setw(5)<<tofClustCat->getEntries() <<
" TOF CLUSTER " <<endl; }
919 if(rpcClustCat) { cout<<setw(5)<<rpcClustCat->getEntries() <<
" RPC CLUSTER " <<endl; }
920 if(showerHitCat){ cout<<setw(5)<<showerHitCat->getEntries()<<
" SHOWER HITS " <<endl; }
921 if(emcClusterCat){ cout<<setw(5)<<emcClusterCat->getEntries()<<
" EMC CLUSTERS " <<endl; }
922 if(wallHitCat) { cout<<setw(5)<<wallHitCat->getEntries() <<
" WALL HITS " <<endl; }
923 cout<<
"nCandLep = "<<nCandLep
924 <<
"\nnCandLepBest = "<<nCandLepBest
925 <<
"\nnCandHad = "<<nCandHad
926 <<
"\nnCandHadBest = "<<nCandHadBest
935 gEve->Redraw3D(kFALSE,kFALSE);
938 if(gSystem->AccessPathName(picturepath.Data())) {
939 gSystem->MakeDirectory(picturepath.Data());
943 TGLViewer* viewer = gEve->GetDefaultGLViewer();
944 TEveViewer* eviewer = gEve->GetDefaultViewer();
946 TString format = picturepath +
"/" + picturemask;
947 gSystem->ProcessEvents();
949 eviewer->GetGLViewer()->SavePicture(Form(format.Data(),seqNumber));
950 eviewer->GetGLViewer()->SavePicture(
"viewer.gif+500");
951 cout<<
"Saved Picture : for event "<<seqNumber <<
", "<< Form(format.Data(),seqNumber) <<endl;
955 cout<<
"REAL time="<<timer.RealTime()<<
",CPU time="<<timer.CpuTime()<<endl;
965 while(setup->
fCheckTimed->IsOn() && returnval == 0){
967 for(Int_t i = 0; i <= 2*sleep; i ++){
969 gSystem->ProcessEvents();
971 returnval = nextEvent();
972 gSystem->ProcessEvents();
982 #endif // __NEXTEVENT__
void resetFlags(Bool_t flag=kTRUE, Bool_t reject=kTRUE, Bool_t used=kTRUE, Bool_t lepton=kTRUE)
HEDGroup * particlecandHad
TEveElementList * geantRichDirectList
TEveElementList * geantRichList
HEDGroup * particlecandNoLep
HEDGroup * particlecandLep
void cleanUp(Bool_t final=kTRUE)
HEDNumberLabeled * fNumberLoopTime
run nextEvent() with timer
void getVertex(Float_t &ax, Float_t &ay, Float_t &az)
Bool_t isFlagBit(eFlagBits bit)
void AddElement(Int_t i, Int_t j, TEveElement *el)
void SetColorPadPlaneHit(Color_t val)
void getAddress(Int_t &s, Int_t &m, Int_t &l, Int_t &c)
void SetLineStyle(Style_t val)
TEveTrackList * simTrackListSeco
void SetLineColor(Color_t val)
const Cat_t catMdcGeantRaw
TEveElementList * geantList
HEvent *& getCurrentEvent(void)
static HEDEvtNavHandler * getHandler()
TGNumberEntry * GetTGNumberEntry() const
Char_t getSector(void) const
virtual HEventHeader * getHeader(void) const
TEveElementList * getList(Int_t n) const
static T * getObject(T *pout, Short_t num=-1, Int_t index=-1, Bool_t silent=kFALSE)
TEveElementList * wallPlane
static TEveTrackPropagator * g_prop
Int_t fill(Bool_t(*function)(HParticleCand *))
Int_t getParentTrack(void) const
TEveTrackList * simTrackListPrim
const Cat_t catTofCluster
const Cat_t catEmcCluster
Bool_t selectLeptonsBeta(HParticleCand *pcand)
static void setGraphic(Short_t pid, Int_t col, Int_t style)
HEDGroup2D * allMdcWiresNotUsed
Int_t eventLoop(Int_t nEvents=kMaxInt, Int_t firstEvent=0, Double_t timeQuota=1.e+20)
const Cat_t catRichGeantRaw
const Cat_t catRpcCluster
TEveElementList * vertexlist
map< Int_t, TEveTrackList * > mapPrim
Bool_t isGhostTrack() const
void SetLineColor(Color_t val)
static HEDEvtNavHandler * gEDEvtNavHandler
const Cat_t catWallGeantRaw
TEveElementList * secoList
TEveTrackList * simTrackList
Int_t selectBest(Particle::ESwitch byQuality, Int_t byParticle)
static HEDSetup * getEDSetup(const TGWindow *p=0, UInt_t w=0, UInt_t h=0)
virtual HCategory * getCategory(Cat_t aCat)=0
TGCheckButton * fCheckTimed
call reDraw() on click text button
HEDGroup * richhitpadplane
static Int_t pid(const Char_t *pidName)
HEDMdcWireManager * wires
Bool_t init(HRecEvent *evt=0)
Short_t getSector() const
void SetColorMirrorHit(Color_t val)
TEveElementList * primList
Bool_t selectHadrons(HParticleCand *pcand)
void getMomentum(Float_t &apx, Float_t &apy, Float_t &apz)
static Int_t lineColor(const Int_t id)
TEveElementList * wallHits
static void setDefaultGraphic(Int_t col, Int_t style)
map< Int_t, TEveTrackList * > mapSeco
void AddElement(Int_t n, TEveElement *el)
HEDGroup * richpadplanecleaned
const Cat_t catParticleCand
Int_t isUsedNtimes(Int_t s, Int_t m, Int_t l, Int_t c)