10 #include <TLorentzVector.h>
13 #include "JANA/JApplication.h"
56 InitJANAPlugin(locApplication);
74 TDirectory *
main = gDirectory;
75 gDirectory->mkdir(
"bcal_inv_mass")->cd();
77 bcal_diphoton_mass_300 =
new TH1I(
"bcal_diphoton_mass_300",
"bcal diphoton mass (Cluster E > 300 MeV)",100,0.0,1.0);
81 bcal_diphoton_mass_500 =
new TH1I(
"bcal_diphoton_mass_500",
"bcal diphoton mass (Cluster E > 500 MeV)",100,0.0,1.0);
85 bcal_diphoton_mass_700 =
new TH1I(
"bcal_diphoton_mass_700",
"bcal diphoton mass (Cluster E > 700 MeV)",100,0.0,1.0);
89 bcal_diphoton_mass_900 =
new TH1I(
"bcal_diphoton_mass_900",
"bcal diphoton mass (Cluster E > 900 MeV)",100,0.0,1.0);
93 bcal_diphoton_mass_v_E =
new TH2I(
"bcal_diphoton_mass_v_E",
"bcal diphoton mass v E(Both Showers within 100 MeV)",600,0,1.2,100,0,.3);
97 bcal_diphoton_mass_v_z_lowE =
new TH2I(
"bcal_diphoton_mass_v_z_lowE",
"bcal diphoton mass v z(Both showers 300<E<500MeV)",213,0,426,100,0,.3);
101 bcal_diphoton_mass_v_z_highE =
new TH2I(
"bcal_diphoton_mass_v_z_highE",
"bcal diphoton mass v z(Both showers 500<E<700MeV)",213,0,426,100,0,.3);
105 bcal_fcal_diphoton_mass_300 =
new TH1I(
"bcal_fcal_diphoton_mass_300",
"bcal and fcal diphoton mass (Cluster E > 300 MeV)",100,0.0,1.0);
109 bcal_fcal_diphoton_mass_500 =
new TH1I(
"bcal_fcal_diphoton_mass_500",
"bcal and fcal diphoton mass (Cluster E > 500 MeV)",100,0.0,1.0);
113 bcal_fcal_diphoton_mass_700 =
new TH1I(
"bcal_fcal_diphoton_mass_700",
"bcal and fcal diphoton mass (Cluster E > 700 MeV)",100,0.0,1.0);
117 bcal_fcal_diphoton_mass_900 =
new TH1I(
"bcal_fcal_diphoton_mass_900",
"bcal and fcal diphoton mass (Cluster E > 900 MeV)",100,0.0,1.0);
172 locEventLoop->GetSingle(locTrigger);
176 vector<const DTrackFitter *> fitters;
177 locEventLoop->Get(fitters);
179 if(fitters.size()<1){
180 _DBG_<<
"Unable to get a DTrackFinder object!"<<endl;
181 return RESOURCE_UNAVAILABLE;
185 vector<const DBCALShower*> locBCALShowers;
186 vector<const DFCALCluster*> locFCALClusters;
187 vector<const DVertex*> kinfitVertex;
190 locEventLoop->Get(locBCALShowers);
191 locEventLoop->Get(locFCALClusters);
192 locEventLoop->Get(kinfitVertex);
194 if(locBCALShowers.size() > 15)
return NOERROR;
196 vector<const DTrackTimeBased*> locTrackTimeBased;
197 locEventLoop->Get(locTrackTimeBased);
199 vector <const DBCALShower*> matchedShowers;
200 vector <const DFCALCluster*> matchedFCALClusters;
201 vector <const DTrackTimeBased*> matchedTracks;
204 for (
unsigned int i=0; i < locTrackTimeBased.size() ; ++i){
205 vector<DTrackFitter::Extrapolation_t>extrapolations=locTrackTimeBased[i]->extrapolations.at(
SYS_BCAL);
206 if (extrapolations.size()>0){
207 for (
unsigned int j=0; j< locBCALShowers.size(); ++j){
209 double x = locBCALShowers[j]->x;
210 double y = locBCALShowers[j]->y;
211 double z = locBCALShowers[j]->z;
213 double R = pos_bcal.Perp();
216 double dPhi = mypos.Phi()-pos_bcal.Phi();
217 if (dPhi<-M_PI) dPhi+=2.*M_PI;
218 if (dPhi>M_PI) dPhi-=2.*M_PI;
219 double dZ = TMath::Abs(mypos.Z() - z);
221 if(dZ < 30.0 && fabs(dPhi) < 0.18 ) {
222 matchedShowers.push_back(locBCALShowers[j]);
223 matchedTracks.push_back(locTrackTimeBased[i]);
231 for(
unsigned int i = 0 ; i < locTrackTimeBased.size(); ++i)
233 vector<DTrackFitter::Extrapolation_t>extrapolations=locTrackTimeBased[i]->extrapolations.at(
SYS_FCAL);
234 if (extrapolations.size()>0){
235 for(
unsigned int j = 0 ; j < locFCALClusters.size(); ++j)
243 DVector3 pos=extrapolations[0].position;
245 double diffX = TMath::Abs(x - pos.X());
246 double diffY = TMath::Abs(y - pos.Y());
247 if(diffX < 3.0 && diffY < 3.0)
249 matchedFCALClusters.push_back(locFCALClusters[j]);
256 vector <const DChargedTrackHypothesis*> locParticles;
257 double kinfitVertexX = 0.0, kinfitVertexY = 0.0, kinfitVertexZ = 0.0;
258 for (
unsigned int i = 0 ; i < kinfitVertex.size(); i++)
260 kinfitVertexX = kinfitVertex[i]->dSpacetimeVertex.X();
261 kinfitVertexY = kinfitVertex[i]->dSpacetimeVertex.Y();
262 kinfitVertexZ = kinfitVertex[i]->dSpacetimeVertex.Z();
269 japp->RootFillLock(
this);
271 for(
unsigned int i=0; i<locBCALShowers.size(); i++)
275 if (find(matchedShowers.begin(), matchedShowers.end(),locBCALShowers[i]) != matchedShowers.end())
continue;
277 double dx1 = s1->
x - kinfitVertexX;
278 double dy1 = s1->
y - kinfitVertexY;
279 double dz1 = s1->
z - kinfitVertexZ;
281 double R1 =
sqrt(dx1*dx1 + dy1*dy1 + dz1*dz1);
283 double E1_raw = s1->
E_raw;
284 TLorentzVector sh1_p(E1*dx1/R1, E1*dy1/R1, E1*dz1/R1, E1);
285 TLorentzVector sh1_p_raw(E1_raw*dx1/R1, E1_raw*dy1/R1, E1_raw*dz1/R1, E1_raw);
286 for(
unsigned int j=i+1; j<locBCALShowers.size(); j++){
288 if (find(matchedShowers.begin(), matchedShowers.end(),s2) != matchedShowers.end())
continue;
289 double dx2 = s2->
x - kinfitVertexX;
290 double dy2 = s2->
y - kinfitVertexY;
291 double dz2 = s2->
z - kinfitVertexZ;
293 double z_avg = (z1+z2)/2.;
294 double R2 =
sqrt(dx2*dx2 + dy2*dy2 + dz2*dz2);
296 double E2_raw = s2->
E_raw;
297 double E_avg = (E1_raw + E2_raw)/2.;
298 TLorentzVector sh2_p(E2*dx2/R2, E2*dy2/R2, E2*dz2/R2, E2);
299 TLorentzVector sh2_p_raw(E2_raw*dx2/R2, E2_raw*dy2/R2, E2_raw*dz2/R2, E2_raw);
300 TLorentzVector ptot = sh1_p+sh2_p;
301 TLorentzVector ptot_raw = sh1_p_raw + sh2_p_raw ;
302 double inv_mass_raw = ptot_raw.M();
311 for(
unsigned int j=0; j<locFCALClusters.size(); j++){
312 if (find(matchedFCALClusters.begin(), matchedFCALClusters.end(),locFCALClusters[j]) != matchedFCALClusters.end())
continue;
318 double R2 =
sqrt(dx2*dx2 + dy2*dy2 + dz2*dz2);
319 TLorentzVector cl2_p(fcal_E*dx2/R2, fcal_E*dy2/R2, fcal_E*dz2/R2, fcal_E);
320 TLorentzVector ptot_fcal_bcal = sh1_p_raw + cl2_p;
321 double inv_mass = ptot_fcal_bcal.M();
330 japp->RootFillUnLock(
this);
static TH1I * bcal_diphoton_mass_900
DVector3 getCentroid() const
bool ExtrapolateToRadius(double R, const vector< Extrapolation_t > &extraps, DVector3 &pos, DVector3 &mom, double &t, double &s) const
The DTrackFitter class is a base class for different charged track fitting algorithms. It does not actually fit the track itself, but provides the interface and some common support features most algorthims will need to implement.
static TH1I * bcal_diphoton_mass_500
uint32_t Get_L1FrontPanelTriggerBits(void) const
jerror_t fini(void)
Called after last event of last event source has been processed.
static TH1I * bcal_fcal_diphoton_mass_700
static TH2I * bcal_diphoton_mass_v_z_highE
static TH2I * bcal_diphoton_mass_v_E
jerror_t brun(jana::JEventLoop *locEventLoop, int locRunNumber)
Called every time a new run number is detected.
static TH1I * bcal_fcal_diphoton_mass_900
jerror_t init(void)
Called once at program start.
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t locEventNumber)
Called every event.
const DTrackFitter * fitter
jerror_t erun(void)
Called every time run number changes, provided brun has been called.
static TH1I * bcal_diphoton_mass_300
static TH2I * bcal_diphoton_mass_v_z_lowE
static TH1I * bcal_fcal_diphoton_mass_500
static TH1I * bcal_fcal_diphoton_mass_300
static TH1I * bcal_diphoton_mass_700
int main(int argc, char *argv[])