Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

MasterShowerModule - source file

// $Id: MasterShowerModule.cc,v 1.2 2004/11/25 18:49:31 naumov Exp $
// Author: Dmitry V.Naumov   σΕΞ, 24 2004

/*****************************************************************************
 * ESAF: Euso Simulation and Analysis Framework                              *
 *                                                                           *
 *  Id: MasterShowerModule                                                           *
 *  Package: <packagename>                                                   *
 *  Coordinator: <coordinator>                                               *
 *                                                                           *
 *****************************************************************************/

//_____________________________________________________________________________
//
// MasterShowerModule
//
// <extensive class description>
//
//   Config file parameters
//   ======================
//
//   <parameter name>: <parameter description>
//   -Valid options: <available options>
//

#include "MasterShowerModule.hh"
#include "RecoEvent.hh"
#include "RecoPixelData.hh"
#include "RecoRootEvent.hh"
#include "Config.hh"

#include <TCanvas.h>
#include <TH1F.h>
#include <TF1.h>

ClassImp(MasterShowerModule)

//_____________________________________________________________________________
MasterShowerModule::MasterShowerModule() : RecoModule("MasterShower") {
    // ctor

}

//_____________________________________________________________________________
MasterShowerModule::~MasterShowerModule() {
    // dtor
}

//_____________________________________________________________________________
 Bool_t MasterShowerModule::Init() {
     return kTRUE;
}

//_____________________________________________________________________________
 Bool_t MasterShowerModule::PreProcess() {
     return kTRUE;
}

//_____________________________________________________________________________
 Bool_t MasterShowerModule::Process(RecoEvent *ev) {
    
    const RecoModuleData *td = ev->GetModuleData("TrackDirection");
    
    if ( td == NULL ) {
        Msg(EsafMsg::Panic) << "TrackDirectionModule is not found." << MsgDispatch;
        throw runtime_error( "MasterShowerModule failed.");
    }
    
    fTheta    = td->GetDouble("Theta");
    fPhi      = td->GetDouble("Phi");
    fOmega.SetXYZ(TMath::Sin(fTheta)*TMath::Cos(fPhi), 
                  TMath::Sin(fTheta)*TMath::Sin(fPhi), 
                  TMath::Cos(fTheta));
    
    const RecoModuleData *gcm = ev->GetModuleData("GTUClustering");
    if ( gcm == NULL ) {
        Msg(EsafMsg::Panic) << "GTUClusteringModule is not found." << MsgDispatch;
        throw runtime_error("TrackDirectionModule failed.");
    }
    else {
        if ( gcm->GetObj("CluPixels") == NULL ) {
            Msg(EsafMsg::Panic) << "No data in event" << MsgDispatch;	    
            return kFALSE;
        }
        fPointsId = *(vector<Int_t>*)gcm->GetObj("CluPixels");

        if (fPointsId.size() == 0) {
            fNumPoints = 0;
            Msg(EsafMsg::Panic) << "No pixels selected: terminated." << MsgDispatch;	                
            return kFALSE;
        } 
        else {
            fNumPoints = fPointsId.size();
            Msg(EsafMsg::Debug) << "Processing " << fNumPoints << " points" << MsgDispatch;
        }
    }
    fGtuLength = ev->GetHeader().GetGtuLength()/1000;
    fFirstHit  = ev->GetStartGtu();
    fLastHit   = ev->GetEndGtu();
    Float_t Nbins = (Int_t) (fLastHit - fFirstHit)/fGtuLength;
    fTemp = (TH1F*)gDirectory->FindObject("fTemp_MasterShower");
    if ( fTemp != NULL) delete fTemp;
    
    fTemp = new TH1F("fTemp_MasterShower","",(Int_t)Nbins,fFirstHit,fLastHit);
    fTemp->GetXaxis()->SetTitle("time, #mu sec");
    fTemp->GetYaxis()->SetTitle("PhotoElectrons");

    for(Int_t i=0; i<fNumPoints; i++) {
        RecoPixelData *pix = ev->GetRecoPixelData(fPointsId[i]);
        fTemp->Fill(pix->GetGtu(),pix->GetCounts());
	cluster.push_back(pix);
        MsgForm(EsafMsg::Debug,"Gtu: %d Counts: %d Theta %fn",pix->GetGtu(),pix->GetCounts(),pix->GetTheta()); 
    }
     return kTRUE;
}

//_____________________________________________________________________________
 Bool_t MasterShowerModule::PostProcess() {
     return kTRUE;
}

//_____________________________________________________________________________
 Bool_t MasterShowerModule::Done() {
    Msg(EsafMsg::Info) << "Completed" << MsgDispatch;
     return kTRUE;
}

 void MasterShowerModule::UserMemoryClean()  {

}

//_____________________________________________________________________________
 Bool_t MasterShowerModule::SaveRootData(RecoRootEvent *fRecoRootEvent) {
    return kTRUE;
}
About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update 14-May-2005 21:31