14 #include "StEmcOfflineCalibrationMipAnalysis.h"
15 #include "StEmcOfflineCalibrationEvent.h"
30 StEmcOfflineCalibrationMipAnalysis::StEmcOfflineCalibrationMipAnalysis(
const char *name,
const char* outfile, TChain *calibChain):
StMaker(name),nTowers(4800){
31 mCalibChain = calibChain;
32 mOutfileName = (TString)outfile;
39 StEmcOfflineCalibrationMipAnalysis::~StEmcOfflineCalibrationMipAnalysis(){
40 if(mCalibChain)
delete mCalibChain;
41 if(mEvent)
delete mEvent;
42 if(mVertex)
delete mVertex;
43 if(mTrack)
delete mTrack;
44 if (mFile)
delete mFile;
47 Int_t StEmcOfflineCalibrationMipAnalysis::Init(){
48 mFile =
new TFile(mOutfileName,
"RECREATE");
49 mCalibChain->SetBranchAddress(
"event_branch",&mEvent);
52 for (Int_t iTow = 0; iTow < nTowers; ++iTow){
53 sprintf(name,
"tower_histo_%i",iTow+1);
54 towerHisto[iTow] =
new TH1D(name,name,250,-50.5,199.5);
55 towerHisto[iTow]->Sumw2();
58 mapcheck =
new TH2F(
"mapcheck",
"check mapping",4800,0.5,4800.5,4800,0.5,4800.5);
59 mapcheck->GetXaxis()->SetTitle(
"Track Projection ID");
60 mapcheck->GetYaxis()->SetTitle(
"Tower hit above 5 rms");
62 return StMaker::Init();
70 excludedTowers.clear();
73 for (Int_t iTrk = 0; iTrk < mEvent->nTracks(); ++iTrk){
74 mTrack = mEvent->track(iTrk);
75 Int_t softId = mTrack->towerId(0);
77 if(trackTowers.find(softId) != trackTowers.end())
78 excludedTowers.insert(softId);
80 trackTowers.insert(softId);
84 for(Int_t iVert = 0; iVert < mEvent->nVertices(); ++iVert){
85 mVertex = mEvent->vertex(iVert);
87 if (mVertex->ranking() < 1e6)
continue;
88 if (TMath::Abs(mVertex->z()) > 30)
continue;
91 for(Int_t iTrack = 0; iTrack < mVertex->nTracks(); ++iTrack){
92 mTrack = mVertex->track(iTrack);
94 pedSubAdc = mTrack->towerAdc(0) - mTrack->towerPedestal(0);
96 if (excludedTowers.find(mTrack->towerId(0)) != excludedTowers.end())
continue;
97 if (mTrack->p() < 1.)
continue;
98 if (mTrack->towerId(0) != mTrack->towerExitId())
continue;
100 for(Int_t k = 0; k < 9; k++){
101 if(mTrack->towerAdc(k) - mTrack->towerPedestal(k) < 5*mTrack->towerPedestalRms(k))
continue;
102 mapcheck->Fill(mTrack->towerId(0),mTrack->towerId(k));
105 if(mTrack->highestNeighbor() > 2.)
continue;
106 if(pedSubAdc < 1.5*mTrack->towerPedestalRms(0))
continue;
108 Int_t index = mTrack->towerId(0) - 1;
109 towerHisto[index]->Fill(pedSubAdc);