CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BscTest Class Reference

#include <BscTest.h>

Inheritance diagram for BscTest:
Observer< const EndOfEvent * > Observer< const EndOfTrack * > Observer< const G4Step * > Observer< const BeginOfTrack * > Observer< const BeginOfEvent * > Observer< const EndOfRun * > Observer< const BeginOfRun * > Observer< const BeginOfJob * > SimWatcher

Public Member Functions

 BscTest (const edm::ParameterSet &p)
 
 ~BscTest () override
 
- Public Member Functions inherited from SimWatcher
 SimWatcher ()
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfJob * >
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfRun * >
 Observer ()
 
void slotForUpdate (const EndOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step * >
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 

Private Member Functions

void detectorLevel (const G4VTouchable *, int &, int *, G4String *) const
 
int detLevels (const G4VTouchable *) const
 
G4String detName (const G4VTouchable *, int, int) const
 
void update (const BeginOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfJob *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfRun *run) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *step) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

Float_t bsceventarray [1]
 
TNtuple * bsceventntuple
 
TFile bscOutputFile
 
G4double entot0
 
std::string fDataLabel
 
std::string fOutputFile
 
std::string fRecreateFile
 
int iev
 
int itrk
 
G4ThreeVector lastpo
 
int lastTrackID
 
int numofpart
 
double rinCalo
 
G4double SumEnerDeposit
 
G4double SumStepc
 
G4double SumStepl
 
BscNumberingSchemetheBscNumberingScheme
 
BscAnalysisHistManagerTheHistManager
 
G4double tracklength0
 
int verbosity
 
int whichevent
 
double z1
 
double z2
 
double z3
 
double z4
 
double zinCalo
 

Additional Inherited Members

Detailed Description

Definition at line 158 of file BscTest.h.

Constructor & Destructor Documentation

◆ BscTest()

BscTest::BscTest ( const edm::ParameterSet p)

Definition at line 49 of file BscTest.cc.

49  {
50  //constructor
51  edm::ParameterSet m_Anal = p.getParameter<edm::ParameterSet>("BscTest");
52  verbosity = m_Anal.getParameter<int>("Verbosity");
53  //verbosity = 1;
54 
55  fDataLabel = m_Anal.getParameter<std::string>("FDataLabel");
56  fOutputFile = m_Anal.getParameter<std::string>("FOutputFile");
57  fRecreateFile = m_Anal.getParameter<std::string>("FRecreateFile");
58 
59  if (verbosity > 0) {
60  std::cout << "============================================================================" << std::endl;
61  std::cout << "BscTestconstructor :: Initialized as observer" << std::endl;
62  }
63  // Initialization:
64 
66  bsceventntuple = new TNtuple("NTbscevent", "NTbscevent", "evt");
67  whichevent = 0;
69 
70  if (verbosity > 0) {
71  std::cout << "BscTest constructor :: Initialized BscAnalysisHistManager" << std::endl;
72  }
73 }

References bsceventntuple, gather_cfg::cout, fDataLabel, fOutputFile, fRecreateFile, edm::ParameterSet::getParameter(), AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, theBscNumberingScheme, TheHistManager, verbosity, and whichevent.

◆ ~BscTest()

BscTest::~BscTest ( )
override

Definition at line 75 of file BscTest.cc.

75  {
76  // delete UserNtuples;
77  delete theBscNumberingScheme;
78 
79  TFile bscOutputFile("newntbsc.root", "RECREATE");
80  std::cout << "Bsc output root file has been created";
81  bsceventntuple->Write();
82  std::cout << ", written";
83  bscOutputFile.Close();
84  std::cout << ", closed";
85  delete bsceventntuple;
86  std::cout << ", and deleted" << std::endl;
87 
88  //------->while end
89 
90  // Write histograms to file
92  if (verbosity > 0) {
93  std::cout << std::endl << "BscTest Destructor --------> End of BscTest : " << std::endl;
94  }
95 
96  std::cout << "BscTest: End of process" << std::endl;
97 }

References bsceventntuple, bscOutputFile, gather_cfg::cout, fOutputFile, fRecreateFile, theBscNumberingScheme, TheHistManager, verbosity, and BscAnalysisHistManager::WriteToFile().

Member Function Documentation

◆ detectorLevel()

void BscTest::detectorLevel ( const G4VTouchable *  touch,
int &  level,
int *  copyno,
G4String *  name 
) const
private

Definition at line 499 of file BscTest.cc.

499  {
500  //Get name and copy numbers
501  if (level > 0) {
502  for (int ii = 0; ii < level; ii++) {
503  int i = level - ii - 1;
504  G4VPhysicalVolume* pv = touch->GetVolume(i);
505  if (pv != nullptr)
506  name[ii] = pv->GetName();
507  else
508  name[ii] = "Unknown";
509  copyno[ii] = touch->GetReplicaNumber(i);
510  }
511  }
512 }

References mps_fire::i, cuy::ii, personalPlayback::level, Skims_PA_cff::name, and MetAnalyzer::pv().

Referenced by update().

◆ detLevels()

int BscTest::detLevels ( const G4VTouchable *  touch) const
private

Definition at line 480 of file BscTest.cc.

480  {
481  //Return number of levels
482  if (touch)
483  return ((touch->GetHistoryDepth()) + 1);
484  else
485  return 0;
486 }

Referenced by update().

◆ detName()

G4String BscTest::detName ( const G4VTouchable *  touch,
int  level,
int  currentlevel 
) const
private

Definition at line 489 of file BscTest.cc.

489  {
490  //Go down to current level
491  if (level > 0 && level >= currentlevel) {
492  int ii = level - currentlevel;
493  return touch->GetVolume(ii)->GetName();
494  } else {
495  return "NotFound";
496  }
497 }

References cuy::ii, and personalPlayback::level.

◆ update() [1/8]

void BscTest::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 257 of file BscTest.cc.

257  {
258  iev = (*evt)()->GetEventID();
259  if (verbosity > 0) {
260  std::cout << "BscTest:update Event number = " << iev << std::endl;
261  }
262  whichevent++;
263 }

References gather_cfg::cout, iev, verbosity, and whichevent.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [2/8]

void BscTest::update ( const BeginOfJob )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 241 of file BscTest.cc.

241  {
242  //job
243  std::cout << "BscTest:beggining of job" << std::endl;
244  ;
245 }

References gather_cfg::cout.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [3/8]

void BscTest::update ( const BeginOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfRun * >.

Definition at line 248 of file BscTest.cc.

248  {
249  //run
250 
251  std::cout << std::endl << "BscTest:: Begining of Run" << std::endl;
252 }

References gather_cfg::cout.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [4/8]

void BscTest::update ( const BeginOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 266 of file BscTest.cc.

266  {
267  itrk = (*trk)()->GetTrackID();
268  if (verbosity > 1) {
269  std::cout << "BscTest:update BeginOfTrack number = " << itrk << std::endl;
270  }
271  if (itrk == 1) {
272  SumEnerDeposit = 0.;
273  numofpart = 0;
274  SumStepl = 0.;
275  SumStepc = 0.;
276  tracklength0 = 0.;
277  }
278 }

References gather_cfg::cout, itrk, numofpart, SumEnerDeposit, SumStepc, SumStepl, tracklength0, and verbosity.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [5/8]

void BscTest::update ( const EndOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfEvent * >.

Definition at line 516 of file BscTest.cc.

516  {
517  // ==========================================================================
518 
519  if (verbosity > 1) {
520  iev = (*evt)()->GetEventID();
521  std::cout << "BscTest:update EndOfEvent = " << iev << std::endl;
522  }
523  // Fill-in ntuple
525 
526  //
527  int trackID = 0;
528  G4PrimaryParticle* thePrim = nullptr;
529 
530  // prim.vertex:
531  G4int nvertex = (*evt)()->GetNumberOfPrimaryVertex();
532  if (nvertex != 1)
533  std::cout << "BscTest: My warning: NumberOfPrimaryVertex != 1 --> = " << nvertex << std::endl;
534 
535  for (int i = 0; i < nvertex; i++) {
536  G4PrimaryVertex* avertex = (*evt)()->GetPrimaryVertex(i);
537  if (avertex == nullptr)
538  std::cout << "BscTest End Of Event ERR: pointer to vertex = 0" << std::endl;
539  G4int npart = avertex->GetNumberOfParticle();
540  if (npart != 1)
541  std::cout << "BscTest: My warning: NumberOfPrimaryPart != 1 --> = " << npart << std::endl;
542  if (npart == 0)
543  std::cout << "BscTest End Of Event ERR: no NumberOfParticle" << std::endl;
544 
545  if (thePrim == nullptr)
546  thePrim = avertex->GetPrimary(trackID);
547 
548  if (thePrim != nullptr) {
549  // primary vertex:
550  G4double vx = 0., vy = 0., vz = 0.;
551  vx = avertex->GetX0();
552  vy = avertex->GetY0();
553  vz = avertex->GetZ0();
554  //UserNtuples->fillh01(vx);
555  //UserNtuples->fillh02(vy);
556  //UserNtuples->fillh03(vz);
557  TheHistManager->GetHisto("VtxX")->Fill(vx);
558  TheHistManager->GetHisto("VtxY")->Fill(vy);
559  TheHistManager->GetHisto("VtxZ")->Fill(vz);
560  }
561  }
562  // prim.vertex loop end
563 
564  //=========================== thePrim != 0 ================================================================================
565  if (thePrim != nullptr) {
566  //
567  // number of secondary particles deposited their energy along primary track
568  //UserNtuples->fillg518(numofpart,1.);
569  if (lastpo.z() < z4 && lastpo.perp() < 100.) {
570  //UserNtuples->fillg536(numofpart,1.);
571  }
572  //
573 
574  // direction !!!
575  G4ThreeVector mom = thePrim->GetMomentum();
576 
577  double phi = atan2(mom.y(), mom.x());
578  if (phi < 0.)
579  phi += twopi;
580  double phigrad = phi * 180. / pi;
581 
582  double th = mom.theta();
583  double eta = -log(tan(th / 2));
584  TheHistManager->GetHisto("PrimaryEta")->Fill(eta);
585  TheHistManager->GetHisto("PrimaryPhigrad")->Fill(phigrad);
586  TheHistManager->GetHisto("PrimaryTh")->Fill(th * 180. / pi);
587 
588  TheHistManager->GetHisto("PrimaryLastpoZ")->Fill(lastpo.z());
589  if (lastpo.z() < z4) {
590  TheHistManager->GetHisto("PrimaryLastpoX")->Fill(lastpo.x());
591  TheHistManager->GetHisto("PrimaryLastpoY")->Fill(lastpo.y());
592  }
593  if (numofpart > 4) {
594  TheHistManager->GetHisto("XLastpoNumofpart")->Fill(lastpo.x());
595  TheHistManager->GetHisto("YLastpoNumofpart")->Fill(lastpo.y());
596  }
597 
598  // ==========================================================================
599 
600  // hit map for Bsc
601  // ==================================
602 
603  std::map<int, float, std::less<int> > themap;
604  std::map<int, float, std::less<int> > themap1;
605 
606  std::map<int, float, std::less<int> > themapxy;
607  std::map<int, float, std::less<int> > themapz;
608  // access to the G4 hit collections: -----> this work OK:
609 
610  // edm::LogInfo("BscTest") << "1";
611  G4HCofThisEvent* allHC = (*evt)()->GetHCofThisEvent();
612  // edm::LogInfo("BscTest") << "2";
613  if (verbosity > 0) {
614  std::cout << "BscTest: accessed all HC" << std::endl;
615  ;
616  }
617  int CAFIid = G4SDManager::GetSDMpointer()->GetCollectionID("BSCHits");
618 
619  BscG4HitCollection* theCAFI = (BscG4HitCollection*)allHC->GetHC(CAFIid);
620  if (verbosity > 0) {
621  std::cout << "BscTest: theCAFI->entries = " << theCAFI->entries() << std::endl;
622  }
623  int varia; // = 0 -all; =1 - MI; =2 - noMI
624  //varia = 0;
625  if (lastpo.z() < z4) {
626  varia = 1;
627  } else {
628  varia = 2;
629  } // no MI end:
630  int nhits = theCAFI->entries();
631  for (int j = 0; j < nhits; j++) {
632  BscG4Hit* aHit = (*theCAFI)[j];
633  const CLHEP::Hep3Vector& hitPoint = aHit->getEntry();
634  double zz = hitPoint.z();
635  TheHistManager->GetHisto("zHits")->Fill(zz);
636  if (tracklength0 > 8300.)
637  TheHistManager->GetHisto("zHitsTrLoLe")->Fill(zz);
638  }
639 
640  if (varia == 2) {
641  int nhit11 = 0, nhit12 = 0, nhit13 = 0;
642  double totallosenergy = 0.;
643  for (int j = 0; j < nhits; j++) {
644  BscG4Hit* aHit = (*theCAFI)[j];
645 
646  const CLHEP::Hep3Vector& hitEntryLocalPoint = aHit->getEntryLocalP();
647  const CLHEP::Hep3Vector& hitExitLocalPoint = aHit->getExitLocalP();
648  const CLHEP::Hep3Vector& hitPoint = aHit->getEntry();
649  int trackIDhit = aHit->getTrackID();
650  unsigned int unitID = aHit->getUnitID();
651  double losenergy = aHit->getEnergyLoss();
652 
653  double zz = hitPoint.z();
654 
655  TheHistManager->GetHisto("zHitsnoMI")->Fill(zz);
656 
657  if (verbosity > 2) {
658  std::cout << "BscTest:zHits = " << zz << std::endl;
659  }
660 
661  themap[unitID] += losenergy;
662  totallosenergy += losenergy;
663 
664  int zside, sector;
666  zside = (unitID & 32) >> 5;
667  sector = (unitID & 7);
668 
669  //
670  //=======================================
671  G4ThreeVector middle = (hitExitLocalPoint + hitEntryLocalPoint) / 2.;
672  themapz[unitID] = hitPoint.z() + middle.z();
673  //=======================================
674  // Y
675  if (zside == 1) {
676  //UserNtuples->fillg24(losenergy,1.);
677  if (losenergy > 0.00003) {
678  themap1[unitID] += 1.;
679  }
680  }
681  //X
682  if (zside == 2) {
683  //UserNtuples->fillg25(losenergy,1.);
684  if (losenergy > 0.00005) {
685  themap1[unitID] += 1.;
686  }
687  }
688  // }
689  //
690  if (sector == 1) {
691  nhit11 += 1;
692  //UserNtuples->fillg33(rr,1.);
693  //UserNtuples->fillg11(yy,1.);
694  }
695  if (sector == 2) {
696  nhit12 += 1;
697  //UserNtuples->fillg34(rr,1.);
698  //UserNtuples->fillg86(yy,1.);
699  }
700  if (sector == 3) {
701  nhit13 += 1;
702  //UserNtuples->fillg35(rr,1.);
703  //UserNtuples->fillg87(yy,1.);
704  }
705 
706  if (lastpo.z() < z4 && lastpo.perp() < 120.) {
707  // MIonly:
708  //UserNtuples->fillg16(lastpo.z(),1.);
709  //UserNtuples->fillg18(zz,1.);
710  // Station I
711  if (zz < z2) {
712  //UserNtuples->fillg54(dx,1.);
713  //UserNtuples->fillg55(dy,1.);
714  }
715  // Station II
716  if (zz < z3 && zz > z2) {
717  //UserNtuples->fillg50(dx,1.);
718  //UserNtuples->fillg51(dy,1.);
719  }
720  // Station III
721  if (zz < z4 && zz > z3) {
722  //UserNtuples->fillg64(dx,1.);
723  //UserNtuples->fillg65(dy,1.);
724  //UserNtuples->filld209(xx,yy,1.);
725  }
726  } else {
727  // no MIonly:
728  //UserNtuples->fillg17(lastpo.z(),1.);
729  //UserNtuples->fillg19(zz,1.);
730  //UserNtuples->fillg74(incidentEnergyHit,1.);
731  //UserNtuples->fillg75(float(trackIDhit),1.);
732  // Station I
733  if (zz < z2) {
734  //UserNtuples->fillg56(dx,1.);
735  //UserNtuples->fillg57(dy,1.);
736  //UserNtuples->fillg20(numofpart,1.);
737  //UserNtuples->fillg21(SumEnerDeposit,1.);
738  if (zside == 1) {
739  //UserNtuples->fillg26(losenergy,1.);
740  }
741  if (zside == 2) {
742  //UserNtuples->fillg76(losenergy,1.);
743  }
744  if (trackIDhit == 1) {
745  //UserNtuples->fillg70(dx,1.);
746  //UserNtuples->fillg71(incidentEnergyHit,1.);
747  //UserNtuples->fillg79(losenergy,1.);
748  } else {
749  //UserNtuples->fillg82(dx,1.);
750  }
751  }
752  // Station II
753  if (zz < z3 && zz > z2) {
754  //UserNtuples->fillg52(dx,1.);
755  //UserNtuples->fillg53(dy,1.);
756  //UserNtuples->fillg22(numofpart,1.);
757  //UserNtuples->fillg23(SumEnerDeposit,1.);
758  //UserNtuples->fillg80(incidentEnergyHit,1.);
759  //UserNtuples->fillg81(float(trackIDhit),1.);
760  if (zside == 1) {
761  //UserNtuples->fillg27(losenergy,1.);
762  }
763  if (zside == 2) {
764  //UserNtuples->fillg77(losenergy,1.);
765  }
766  if (trackIDhit == 1) {
767  //UserNtuples->fillg72(dx,1.);
768  //UserNtuples->fillg73(incidentEnergyHit,1.);
769  } else {
770  //UserNtuples->fillg83(dx,1.);
771  }
772  }
773  // Station III
774  if (zz < z4 && zz > z3) {
775  if (zside == 1) {
776  //UserNtuples->fillg28(losenergy,1.);
777  }
778  if (zside == 2) {
779  //UserNtuples->fillg78(losenergy,1.);
780  }
781  }
782  }
783  } // MIonly or noMIonly ENDED
784  if (totallosenergy == 0.0) {
785  std::cout << "BscTest: number of hits = " << theCAFI->entries() << std::endl;
786  for (int j = 0; j < nhits; j++) {
787  BscG4Hit* aHit = (*theCAFI)[j];
788  double losenergy = aHit->getEnergyLoss();
789  std::cout << " j hits = " << j << "losenergy = " << losenergy << std::endl;
790  }
791  }
792  // FIBRE Hit collected analysis
793  double totalEnergy = 0.;
794  int nhitsX = 0, nhitsY = 0, nsumhit = 0;
795  for (int sector = 1; sector < 4; sector++) {
796  int nhitsecX = 0, nhitsecY = 0;
797  for (int zmodule = 1; zmodule < 11; zmodule++) {
798  for (int zside = 1; zside < 3; zside++) {
799  int det = 1; // nhit = 0;
800  // int sScale = 20;
801  int index = BscNumberingScheme::packBscIndex(det, zside, sector);
802  double theTotalEnergy = themap[index];
803  // X planes
804  if (zside < 2) {
805  //UserNtuples->fillg47(theTotalEnergy,1.);
806  if (theTotalEnergy > 0.00003) {
807  nhitsX += 1;
808  // nhitsecX += themap1[index];
809  // nhit=1;
810  }
811  }
812  // Y planes
813  else {
814  //UserNtuples->fillg49(theTotalEnergy,1.);
815  if (theTotalEnergy > 0.00005) {
816  nhitsY += 1;
817  // nhitsecY += themap1[index];
818  // nhit=1;
819  }
820  }
821 
822  totalEnergy += themap[index];
823  } // for
824  } // for
825  //UserNtuples->fillg39(nhitsecY,1.);
826  if (nhitsecX > 10 || nhitsecY > 10) {
827  nsumhit += 1;
828  //UserNtuples->fillp213(float(sector),float(1.),1.);
829  } else { //UserNtuples->fillp213(float(sector),float(0.),1.);
830  }
831  } // for
832 
833  if (nsumhit >= 2) { //UserNtuples->fillp212(vy,float(1.),1.);
834  } else { //UserNtuples->fillp212(vy,float(0.),1.);
835  }
836  } // MI or no MI or all - end
837  } // primary end
838 
839  if (verbosity > 0) {
840  std::cout << "BscTest: END OF Event " << (*evt)()->GetEventID() << std::endl;
841  }
842 }

References bsceventarray, gather_cfg::cout, PVValHelper::eta, dqmMemoryStats::float, BscG4Hit::getEnergyLoss(), BscG4Hit::getEntry(), BscG4Hit::getEntryLocalP(), BscG4Hit::getExitLocalP(), BscAnalysisHistManager::GetHisto(), BscG4Hit::getTrackID(), BscG4Hit::getUnitID(), mps_fire::i, iev, dqmiolumiharvest::j, lastpo, dqm-mbProfile::log, nhits, npart, ntbsc_evt, numofpart, BscNumberingScheme::packBscIndex(), phi, pi, funct::tan(), TheHistManager, tracklength0, BscNumberingScheme::unpackBscIndex(), verbosity, whichevent, z2, z3, z4, ecaldqm::zside(), and geometryCSVtoXML::zz.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [6/8]

void BscTest::update ( const EndOfRun )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfRun * >.

Definition at line 254 of file BscTest.cc.

254 { ; }

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [7/8]

void BscTest::update ( const EndOfTrack )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const EndOfTrack * >.

Definition at line 281 of file BscTest.cc.

281  {
282  itrk = (*trk)()->GetTrackID();
283  if (verbosity > 1) {
284  std::cout << "BscTest:update EndOfTrack number = " << itrk << std::endl;
285  }
286  if (itrk == 1) {
287  G4double tracklength = (*trk)()->GetTrackLength(); // Accumulated track length
288 
289  TheHistManager->GetHisto("SumEDep")->Fill(SumEnerDeposit);
290  TheHistManager->GetHisto("TrackL")->Fill(tracklength);
291 
292  // direction !!!
293  G4ThreeVector vert_mom = (*trk)()->GetVertexMomentumDirection();
294  G4ThreeVector vert_pos = (*trk)()->GetVertexPosition(); // vertex ,where this track was created
295 
296  // last step information
297  const G4Step* aStep = (*trk)()->GetStep();
298  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
299  lastpo = preStepPoint->GetPosition();
300  }
301 }

References gather_cfg::cout, BscAnalysisHistManager::GetHisto(), itrk, lastpo, SumEnerDeposit, TheHistManager, and verbosity.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [8/8]

void BscTest::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 306 of file BscTest.cc.

306  {
307  // ==========================================================================
308 
309  if (verbosity > 2) {
310  G4int stepnumber = aStep->GetTrack()->GetCurrentStepNumber();
311  std::cout << "BscTest:update Step number = " << stepnumber << std::endl;
312  }
313  // track on aStep: !
314  G4Track* theTrack = aStep->GetTrack();
315  TrackInformation* trkInfo = dynamic_cast<TrackInformation*>(theTrack->GetUserInformation());
316  if (trkInfo == nullptr) {
317  std::cout << "BscTest on aStep: No trk info !!!! abort " << std::endl;
318  }
319  G4int id = theTrack->GetTrackID();
320  G4String particleType = theTrack->GetDefinition()->GetParticleName(); // !!!
321  G4int parentID = theTrack->GetParentID(); // !!!
322  G4TrackStatus trackstatus = theTrack->GetTrackStatus(); // !!!
323  G4double tracklength = theTrack->GetTrackLength(); // Accumulated track length
324  G4ThreeVector trackmom = theTrack->GetMomentum();
325  G4double entot = theTrack->GetTotalEnergy(); // !!! deposited on step
326  G4int curstepnumber = theTrack->GetCurrentStepNumber();
327  G4double stepl = aStep->GetStepLength();
328  G4double EnerDeposit = aStep->GetTotalEnergyDeposit();
329  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
330  const G4ThreeVector& preposition = preStepPoint->GetPosition();
331  G4ThreeVector prelocalpoint = theTrack->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(preposition);
332  G4VPhysicalVolume* currentPV = preStepPoint->GetPhysicalVolume();
333  const G4String& prename = currentPV->GetName();
334 
335  const G4VTouchable* pre_touch = preStepPoint->GetTouchable();
336  int pre_levels = detLevels(pre_touch);
337  G4String name1[20];
338  int copyno1[20];
339  for (int i = 0; i < 20; ++i) {
340  name1[i] = "";
341  copyno1[i] = 0;
342  }
343  if (pre_levels > 0) {
344  detectorLevel(pre_touch, pre_levels, copyno1, name1);
345  }
346 
347  if (id == 1) {
348  // on 1-st step:
349  if (curstepnumber == 1) {
350  entot0 = entot;
351  //UserNtuples->fillg519(entot0,1.);
352  }
353 
354  // on every step:
355 
356  // for Copper:
357  if (prename == "SBST") {
358  SumStepc += stepl;
359  // =========
360  }
361  // for ststeel:
362  // if(prename == "SBSTs") {
363  if (prename == "SBSTs") {
364  SumStepl += stepl;
365  // =========
366  }
367  // =========
368  // =========
369 
370  // exclude last track point if it is in SD (MI was started their)
371  if (trackstatus != 2) {
372  // for SD: Si Det.: SISTATION:SIPLANE:(SIDETL+BOUNDDET +SIDETR + CERAMDET)
373  if (prename == "SIDETL" || prename == "SIDETR") {
374  if (prename == "SIDETL") {
375  //UserNtuples->fillg569(EnerDeposit,1.);
376  }
377  if (prename == "SIDETR") {
378  //UserNtuples->fillg570(EnerDeposit,1.);
379  }
380 
381  G4String posname = aStep->GetPostStepPoint()->GetPhysicalVolume()->GetName();
382  if ((prename == "SIDETL" && posname != "SIDETL") || (prename == "SIDETR" && posname != "SIDETR")) {
383  if (name1[2] == "SISTATION") {
384  //UserNtuples->fillg539(copyno1[2],1.);
385  }
386  if (name1[3] == "SIPLANE") {
387  //UserNtuples->fillg540(copyno1[3],1.);
388  }
389 
390  if (prename == "SIDETL") {
391  //UserNtuples->fillg541(EnerDeposit,1.);
392  //UserNtuples->fillg561(numbcont,1.);
393  if (copyno1[2] < 2) {
394  //UserNtuples->fillg571(dx,1.);
395  } else if (copyno1[2] < 3) {
396  //UserNtuples->fillg563(dx,1.);
397  if (copyno1[3] < 2) {
398  } else if (copyno1[3] < 3) {
399  //UserNtuples->fillg572(dx,1.);
400  } else if (copyno1[3] < 4) {
401  //UserNtuples->fillg573(dx,1.);
402  } else if (copyno1[3] < 5) {
403  //UserNtuples->fillg574(dx,1.);
404  } else if (copyno1[3] < 6) {
405  //UserNtuples->fillg575(dx,1.);
406  } else if (copyno1[3] < 7) {
407  //UserNtuples->fillg576(dx,1.);
408  } else if (copyno1[3] < 8) {
409  //UserNtuples->fillg577(dx,1.);
410  } else if (copyno1[3] < 9) {
411  //UserNtuples->fillg578(dx,1.);
412  } else if (copyno1[3] < 10) {
413  //UserNtuples->fillg579(dx,1.);
414  }
415  } else if (copyno1[2] < 4) {
416  //UserNtuples->fillg565(dx,1.);
417  } else if (copyno1[2] < 5) {
418  //UserNtuples->fillg567(dx,1.);
419  }
420  }
421  if (prename == "SIDETR") {
422  //UserNtuples->fillg542(EnerDeposit,1.);
423  //UserNtuples->fillg562(numbcont,1.);
424  if (copyno1[2] < 2) {
425  //UserNtuples->fillg581(dy,1.);
426  } else if (copyno1[2] < 3) {
427  //UserNtuples->fillg564(dy,1.);
428  if (copyno1[3] < 2) {
429  } else if (copyno1[3] < 3) {
430  //UserNtuples->fillg582(dy,1.);
431  } else if (copyno1[3] < 4) {
432  //UserNtuples->fillg583(dy,1.);
433  } else if (copyno1[3] < 5) {
434  //UserNtuples->fillg584(dy,1.);
435  } else if (copyno1[3] < 6) {
436  //UserNtuples->fillg585(dy,1.);
437  } else if (copyno1[3] < 7) {
438  //UserNtuples->fillg586(dy,1.);
439  } else if (copyno1[3] < 8) {
440  //UserNtuples->fillg587(dy,1.);
441  } else if (copyno1[3] < 9) {
442  //UserNtuples->fillg588(dy,1.);
443  } else if (copyno1[3] < 10) {
444  //UserNtuples->fillg589(dy,1.);
445  }
446  } else if (copyno1[2] < 4) {
447  //UserNtuples->fillg566(dy,1.);
448  } else if (copyno1[2] < 5) {
449  //UserNtuples->fillg568(dy,1.);
450  }
451  }
452  }
453  }
454  // end of prenames SIDETL // SIDETR
455  }
456  // end of trackstatus != 2
457 
458  SumEnerDeposit += EnerDeposit;
459  if (trackstatus == 2) {
460  // primary track length
461  // //UserNtuples->fillg508(tracklength,1.);
462  tracklength0 = tracklength;
463  }
464  }
465  // end of primary track !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
466 
467  if (parentID == 1 && curstepnumber == 1) {
468  // particles deposit their energy along primary track
469  numofpart += 1;
470  if (prename == "SBST") {
471  //UserNtuples->filld225(vert_pos.y(),vert_pos.z(),1.);
472  }
473  if (prename == "SBSTs") {
474  //UserNtuples->filld226(vert_pos.y(),vert_pos.z(),1.);
475  }
476  }
477 }

References gather_cfg::cout, detectorLevel(), detLevels(), entot0, mps_fire::i, numofpart, PbPb_ZMuSkimMuonDPG_cff::particleType, SumEnerDeposit, SumStepc, SumStepl, tracklength0, and verbosity.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ bsceventarray

Float_t BscTest::bsceventarray[1]
private

Definition at line 213 of file BscTest.h.

Referenced by update().

◆ bsceventntuple

TNtuple* BscTest::bsceventntuple
private

Definition at line 214 of file BscTest.h.

Referenced by BscTest(), and ~BscTest().

◆ bscOutputFile

TFile BscTest::bscOutputFile
private

Definition at line 215 of file BscTest.h.

Referenced by ~BscTest().

◆ entot0

G4double BscTest::entot0
private

Definition at line 189 of file BscTest.h.

Referenced by update().

◆ fDataLabel

std::string BscTest::fDataLabel
private

Definition at line 219 of file BscTest.h.

Referenced by BscTest().

◆ fOutputFile

std::string BscTest::fOutputFile
private

Definition at line 220 of file BscTest.h.

Referenced by BscTest(), and ~BscTest().

◆ fRecreateFile

std::string BscTest::fRecreateFile
private

Definition at line 221 of file BscTest.h.

Referenced by BscTest(), and ~BscTest().

◆ iev

int BscTest::iev
private

Definition at line 187 of file BscTest.h.

Referenced by update().

◆ itrk

int BscTest::itrk
private

Definition at line 188 of file BscTest.h.

Referenced by update().

◆ lastpo

G4ThreeVector BscTest::lastpo
private

Definition at line 207 of file BscTest.h.

Referenced by update().

◆ lastTrackID

int BscTest::lastTrackID
private

Definition at line 199 of file BscTest.h.

◆ numofpart

int BscTest::numofpart
private

Definition at line 205 of file BscTest.h.

Referenced by update().

◆ rinCalo

double BscTest::rinCalo
private

Definition at line 198 of file BscTest.h.

◆ SumEnerDeposit

G4double BscTest::SumEnerDeposit
private

Definition at line 203 of file BscTest.h.

Referenced by update().

◆ SumStepc

G4double BscTest::SumStepc
private

Definition at line 203 of file BscTest.h.

Referenced by update().

◆ SumStepl

G4double BscTest::SumStepl
private

Definition at line 203 of file BscTest.h.

Referenced by update().

◆ theBscNumberingScheme

BscNumberingScheme* BscTest::theBscNumberingScheme
private

Definition at line 185 of file BscTest.h.

Referenced by BscTest(), and ~BscTest().

◆ TheHistManager

BscAnalysisHistManager* BscTest::TheHistManager
private

Definition at line 218 of file BscTest.h.

Referenced by BscTest(), update(), and ~BscTest().

◆ tracklength0

G4double BscTest::tracklength0
private

Definition at line 189 of file BscTest.h.

Referenced by update().

◆ verbosity

int BscTest::verbosity
private

Definition at line 200 of file BscTest.h.

Referenced by BscTest(), update(), and ~BscTest().

◆ whichevent

int BscTest::whichevent
private

Definition at line 216 of file BscTest.h.

Referenced by BscTest(), and update().

◆ z1

double BscTest::z1
private

Definition at line 210 of file BscTest.h.

◆ z2

double BscTest::z2
private

Definition at line 210 of file BscTest.h.

Referenced by update().

◆ z3

double BscTest::z3
private

Definition at line 210 of file BscTest.h.

Referenced by update().

◆ z4

double BscTest::z4
private

Definition at line 210 of file BscTest.h.

Referenced by update().

◆ zinCalo

double BscTest::zinCalo
private

Definition at line 198 of file BscTest.h.

personalPlayback.level
level
Definition: personalPlayback.py:22
BscTest::SumStepc
G4double SumStepc
Definition: BscTest.h:203
mps_fire.i
i
Definition: mps_fire.py:355
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
BscTest::TheHistManager
BscAnalysisHistManager * TheHistManager
Definition: BscTest.h:218
BscTest::z2
double z2
Definition: BscTest.h:210
BscG4Hit::getEnergyLoss
float getEnergyLoss() const
Definition: BscG4Hit.h:69
BscAnalysisHistManager::WriteToFile
void WriteToFile(const TString &fOutputFile, const TString &fRecreateFile)
Definition: BscTest.cc:143
BscG4Hit::getTrackID
int getTrackID() const
Definition: BscG4Hit.h:53
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
BscNumberingScheme
Definition: BscNumberingScheme.h:13
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BscG4Hit::getEntryLocalP
const G4ThreeVector & getEntryLocalP() const
Definition: BscG4Hit.h:32
BscTest::entot0
G4double entot0
Definition: BscTest.h:189
BscTest::verbosity
int verbosity
Definition: BscTest.h:200
BscTest::detectorLevel
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
Definition: BscTest.cc:499
BscTest::bscOutputFile
TFile bscOutputFile
Definition: BscTest.h:215
npart
double npart
Definition: HydjetWrapper.h:46
BscG4Hit::getEntry
const G4ThreeVector & getEntry() const
Definition: BscG4Hit.h:29
BscTest::itrk
int itrk
Definition: BscTest.h:188
PVValHelper::eta
Definition: PVValidationHelpers.h:69
BscTest::tracklength0
G4double tracklength0
Definition: BscTest.h:189
BscTest::lastpo
G4ThreeVector lastpo
Definition: BscTest.h:207
BscNumberingScheme::unpackBscIndex
static void unpackBscIndex(const unsigned int &idx)
Definition: BscNumberingScheme.cc:95
BscTest::SumStepl
G4double SumStepl
Definition: BscTest.h:203
BscTest::iev
int iev
Definition: BscTest.h:187
nhits
Definition: HIMultiTrackSelector.h:42
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BscG4HitCollection
G4THitsCollection< BscG4Hit > BscG4HitCollection
Definition: BscG4HitCollection.h:13
edm::ParameterSet
Definition: ParameterSet.h:36
BscTest::whichevent
int whichevent
Definition: BscTest.h:216
BscTest::fDataLabel
std::string fDataLabel
Definition: BscTest.h:219
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
BscTest::SumEnerDeposit
G4double SumEnerDeposit
Definition: BscTest.h:203
TrackInformation
Definition: TrackInformation.h:8
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
BscTest::bsceventarray
Float_t bsceventarray[1]
Definition: BscTest.h:213
BscAnalysisHistManager
Definition: BscTest.h:63
BscTest::detLevels
int detLevels(const G4VTouchable *) const
Definition: BscTest.cc:480
BscAnalysisHistManager::GetHisto
TH1F * GetHisto(Int_t Number)
Definition: BscTest.cc:184
DDAxes::phi
BscG4Hit::getUnitID
uint32_t getUnitID() const
Definition: BscG4Hit.h:56
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
BscTest::theBscNumberingScheme
BscNumberingScheme * theBscNumberingScheme
Definition: BscTest.h:185
BscTest::fOutputFile
std::string fOutputFile
Definition: BscTest.h:220
BscTest::fRecreateFile
std::string fRecreateFile
Definition: BscTest.h:221
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BscG4Hit::getExitLocalP
const G4ThreeVector & getExitLocalP() const
Definition: BscG4Hit.h:35
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
pi
const Double_t pi
Definition: trackSplitPlot.h:36
BscG4Hit
Definition: BscG4Hit.h:17
BscNumberingScheme::packBscIndex
static unsigned int packBscIndex(int det, int zside, int station)
Definition: BscNumberingScheme.cc:83
PbPb_ZMuSkimMuonDPG_cff.particleType
particleType
Definition: PbPb_ZMuSkimMuonDPG_cff.py:27
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
BscTest::bsceventntuple
TNtuple * bsceventntuple
Definition: BscTest.h:214
BscTest::z3
double z3
Definition: BscTest.h:210
BscTest::z4
double z4
Definition: BscTest.h:210
cuy.ii
ii
Definition: cuy.py:590
BscTest::numofpart
int numofpart
Definition: BscTest.h:205
ntbsc_evt
Definition: BscTest.cc:46