Commit 4324ce9f authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬
Browse files

Added Particle Mass Histograms

parent 3f56dfdf
......@@ -42,14 +42,14 @@ using namespace std; // std namespace: so you can do things like 'cou
ClassImp(AliAnalysisTaskMyTask) // classimp: necessary for root
AliAnalysisTaskMyTask::AliAnalysisTaskMyTask() : AliAnalysisTaskSE(),
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0)
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0), fHistMass(0)
{
// default constructor, don't allocate memory here!
// this is used by root for IO purposes, it needs to remain empty
}
//_____________________________________________________________________________
AliAnalysisTaskMyTask::AliAnalysisTaskMyTask(const char* name) : AliAnalysisTaskSE(name),
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0)
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0), fHistMass(0)
{
// constructor
DefineInput(0, TChain::Class()); // define the input of the analysis: in this case we take a 'chain' of events
......@@ -86,10 +86,16 @@ void AliAnalysisTaskMyTask::UserCreateOutputObjects()
// if requested (dont worry about this now)
// example of a histogram
fHistPt = new TH1F("fHistPt", "fHistPt", 100, 0, 10); // create your histogra
fHistPt = new TH1F("fHistPt", "fHistPt", 100, 0, 10); // create your histogram
fOutputList->Add(fHistPt); // don't forget to add it to the list! the list will be written to file, so if you want
// your histogram in the output file, add it to the list!
// my particle mass histogram
Double_t fHistMassEdges[12] = {0.0,0.0005,0.0405,0.08,0.12,0.13,0.17,0.48,0.52,0.92,0.96,1.0}; // 11 bins =>> has 11+1 = 12 edges
fHistMass = new TH1F("fHistMass","Particle Histogram;M_{particle}", 11, fHistMassEdges);
fOutputList->Add(fHistMass);
// Histograms for dimuons
fHistEvents = new TH1F("fHistEvents","fHistEvents;N_{events}",100,0.,10000.);
......@@ -111,7 +117,7 @@ void AliAnalysisTaskMyTask::UserExec(Option_t *)
Int_t Event=0;
Int_t TrigEvent=0;
ofstream summaryfile, eventsdetail, vertexdetail;
ofstream summaryfile, eventsdetail;
summaryfile.open ("events_summary.txt",std::ofstream::app);
eventsdetail.open ("events_detail.txt",std::ofstream::app);
......@@ -147,8 +153,6 @@ Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) ||
*/
vertexdetail << "********** Event " << esd_event_id << ": iTracks = " << iTracks << " **********" << endl << endl;
vertexdetail << "Event\tTrack\tGetY()\tGetZ()" << endl << endl;
for(Int_t i(0); i < iTracks; i++) { // loop over all these tracks
......@@ -172,9 +176,10 @@ Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) ||
//'fixed' fixes the number of decimal places so numbers are vertically aligned
vertexdetail << esd_event_id << "\t" << i << "\t" << fixed << track->GetY() << "\t" << track->GetZ() << "\t" << endl;
fHistPt->Fill(track->Pt()); // plot the pt value of the track in a histogram
fHistMass->Fill(Mass);
}
Event++;
......@@ -182,7 +187,6 @@ Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) ||
fHistEvents->Fill(Event);
summaryfile.close();
eventsdetail.close();
vertexdetail.close();
// continue until all the tracks are processed
PostData(1, fOutputList); // stream the results the analysis of this event to
......
......@@ -22,6 +22,7 @@ class AliAnalysisTaskMyTask : public AliAnalysisTaskSE
AliESDEvent* fESD; //! input event
TList* fOutputList; //! output list
TH1F* fHistPt; //! dummy histogram
TH1F* fHistMass; //!my particle mass histogram !! :D
TH1F* fHistEvents; // Number of events
AliAnalysisTaskMyTask(const AliAnalysisTaskMyTask&); // not implemented
......
......@@ -34,6 +34,7 @@
Int_t esd_event_id = 0; // global variable to store unique event id
Int_t EventID = 0; // is equal to esd-event-id until the selected event (one with an appropriate number of tracks) is reached
class AliAnalysisTaskMyTask; // your analysis class
......@@ -42,14 +43,14 @@ using namespace std; // std namespace: so you can do things like 'cou
ClassImp(AliAnalysisTaskMyTask) // classimp: necessary for root
AliAnalysisTaskMyTask::AliAnalysisTaskMyTask() : AliAnalysisTaskSE(),
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0)
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0), fHistMass(0)
{
// default constructor, don't allocate memory here!
// this is used by root for IO purposes, it needs to remain empty
}
//_____________________________________________________________________________
AliAnalysisTaskMyTask::AliAnalysisTaskMyTask(const char* name) : AliAnalysisTaskSE(name),
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0)
fESD(0), fOutputList(0), fHistPt(0), fHistEvents(0), fHistMass(0)
{
// constructor
DefineInput(0, TChain::Class()); // define the input of the analysis: in this case we take a 'chain' of events
......@@ -90,6 +91,12 @@ void AliAnalysisTaskMyTask::UserCreateOutputObjects()
fOutputList->Add(fHistPt); // don't forget to add it to the list! the list will be written to file, so if you want
// your histogram in the output file, add it to the list!
// my mass histogram
Double_t fHistMassEdges[12] = {0.0,0.0005,0.0405,0.08,0.12,0.13,0.17,0.48,0.52,0.92,0.96,1.0}; // 11 bins =>> has 11+1 = 12 edges
fHistMass = new TH1F("fHistMass","Particle Histogram;M_{particle}", 11, fHistMassEdges);
fOutputList->Add(fHistMass);
// Histograms for dimuons
fHistEvents = new TH1F("fHistEvents","fHistEvents;N_{events}",100,0.,10000.);
......@@ -141,6 +148,11 @@ Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) ||
*/
if(EventID == esd_event_id) {
if(iTracks >= 15 && iTracks <= 30) {EventID = -1;}
else {EventID++;}
} else {EventID = -2;}
for(Int_t i(0); i < iTracks; i++) { // loop over all these tracks
AliESDtrack* track = static_cast<AliESDtrack*>(fESD->GetTrack(i)); // get a track (type AliESDtrack) from the event
......@@ -168,9 +180,17 @@ Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) ||
//'fixed' fixes the number of decimal places so numbers are vertically aligned
fHistPt->Fill(track->Pt()); // plot the pt value of the track in a histogram
fHistPt->Fill(Pt); // plot the pt value of the track in a histogram
if(EventID == -1) { // when we get to the selected event, fill Mass Histogram
fHistMass->Fill(Mass);
}
}
Event++;
esd_event_id++; // Increment global esd_event_id
fHistEvents->Fill(Event);
......
......@@ -22,6 +22,7 @@ class AliAnalysisTaskMyTask : public AliAnalysisTaskSE
AliESDEvent* fESD; //! input event
TList* fOutputList; //! output list
TH1F* fHistPt; //! dummy histogram
TH1F* fHistMass; //! my particle histogram!! :D
TH1F* fHistEvents; // Number of events
AliAnalysisTaskMyTask(const AliAnalysisTaskMyTask&); // not implemented
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment