Skip to content

Commit

Permalink
Merge pull request #795 from JeffersonLab/sdobbs_remove_histogramtools
Browse files Browse the repository at this point in the history
Reduce dependence on HistogramTools
  • Loading branch information
aaust committed Apr 16, 2024
2 parents bf9217d + b9f2810 commit 3d1a2dc
Show file tree
Hide file tree
Showing 17 changed files with 1,542 additions and 939 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*************************************/

#include "JEventProcessor_BCAL_ADC_4ns.h"
#include "HistogramTools.h"
#include "BCAL/DBCALHit.h"
#include "BCAL/DBCALTDCHit.h"
#include "BCAL/DBCALCluster.h"
Expand Down Expand Up @@ -63,6 +62,27 @@ JEventProcessor_BCAL_ADC_4ns::~JEventProcessor_BCAL_ADC_4ns()
jerror_t JEventProcessor_BCAL_ADC_4ns::init(void)
{
// This is called once at program startup.
char channame[50], histtitle[255];

float zminhall = 0;
float zmaxhall = 450;

// create root folder and cd to it, store main dir
TDirectory *main = gDirectory; // save current directory
TDirectory *adchistdir = main->mkdir("BCAL_ADC_Deltat")->mkdir("ZvsDeltat");
adchistdir->cd();

for (int module=0; module<nummodule; module++) {
for (int layer=0; layer<numlayer; layer++) {
for (int sector=0; sector<numsector; sector++) {
sprintf(channame,"M%02iL%iS%i",module+1,layer+1,sector+1);
sprintf(histtitle,"%s Z_{Track} vs #Delta t;#Delta t = t_{US}-t_{DS};Z_{Track} [cm]",channame);
hZvsDeltat[module][layer][sector] = new TH2F(channame,histtitle,480, -30, 30, 250, zminhall, zmaxhall);
}
}
}

main->cd();

return NOERROR;
}
Expand Down Expand Up @@ -116,16 +136,18 @@ jerror_t JEventProcessor_BCAL_ADC_4ns::evnt(JEventLoop *loop, uint64_t eventnumb
}
if (bestHypothesis == NULL) continue;
// Now from this hypothesis we can get the detector matches to the BCAL
const DBCALShowerMatchParams* bcalMatch = bestHypothesis->Get_BCALShowerMatchParams();
//const DBCALShowerMatchParams* bcalMatch = bestHypothesis->Get_BCALShowerMatchParams();
auto bcalMatch = bestHypothesis->Get_BCALShowerMatchParams();
if (bcalMatch == NULL) continue;
const DSCHitMatchParams* scMatch = bestHypothesis->Get_SCHitMatchParams();
// const DSCHitMatchParams* scMatch = bestHypothesis->Get_SCHitMatchParams();
auto scMatch = bestHypothesis->Get_SCHitMatchParams();
if (scMatch == NULL) continue;
DVector3 position = bestHypothesis->position();

// We also need the reference trajectory, which is buried deep in there
const DTrackTimeBased *timeBasedTrack = nullptr;
bestHypothesis->GetSingle(timeBasedTrack);
const DReferenceTrajectory *rt = timeBasedTrack->rt;
const DReferenceTrajectory *rt = timeBasedTrack->rt; // TOFIX: this is deprecated
if (timeBasedTrack->FOM < 0.0027) continue; // 3-sigma cut on tracking FOM

if (timeBasedTrack->Ndof < 10) continue; // CDC: 5 params in fit, 10 dof => [15 hits]; FDC [10 hits]
Expand All @@ -152,8 +174,6 @@ jerror_t JEventProcessor_BCAL_ADC_4ns::evnt(JEventLoop *loop, uint64_t eventnumb
float zmaxhall = 450;
if (rt->GetIntersectionWithRadius(rpoint,proj_pos, &pathLength, &flightTime)==NOERROR){
// Now proj_pos contains the projected position of the track at this particular point within the BCAL
char channame[255];
sprintf(channame, "M%02iL%iS%i", thisPoint->module(), thisPoint->layer(), thisPoint->sector());
double trackHitZ = proj_pos.z();

vector <const DBCALHit*> hitVector;
Expand All @@ -163,9 +183,7 @@ jerror_t JEventProcessor_BCAL_ADC_4ns::evnt(JEventLoop *loop, uint64_t eventnumb
double Deltat = hitVector[0]->t_raw - hitVector[1]->t_raw;
if (hitVector[0]->end==1) Deltat = -Deltat;

sprintf(title, "%s Z_{Track} vs #Delta t;#Delta t = t_{US}-t_{DS};Z_{Track} [cm]", channame);
Fill2DHistogram ("BCAL_ADC_Deltat", "ZvsDeltat", channame, Deltat, trackHitZ, title,
480, -30, 30, 250, zminhall, zmaxhall);
hZvsDeltat[thisPoint->module()][thisPoint->layer()][thisPoint->sector()]->Fill(Deltat, trackHitZ);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@

#include <JANA/JEventProcessor.h>

#include <TH2F.h>

class JEventProcessor_BCAL_ADC_4ns:public jana::JEventProcessor{
public:
JEventProcessor_BCAL_ADC_4ns();
~JEventProcessor_BCAL_ADC_4ns();
const char* className(void){return "JEventProcessor_BCAL_ADC_4ns";}

static const int nummodule=48;
static const int numlayer=4;
static const int numsector=4;


private:
jerror_t init(void); ///< Called once at program start.
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber); ///< Called everytime a new run number is detected.
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber); ///< Called every event.
jerror_t erun(void); ///< Called everytime run number changes, provided brun has been called.
jerror_t fini(void); ///< Called after last event of last event source has been processed.

TH2F *hZvsDeltat[JEventProcessor_BCAL_ADC_4ns::nummodule][JEventProcessor_BCAL_ADC_4ns::numlayer][JEventProcessor_BCAL_ADC_4ns::numsector];

};

#endif // _JEventProcessor_BCAL_ADC_4ns_
Expand Down

0 comments on commit 3d1a2dc

Please sign in to comment.