]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPedestal.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / MUON / AliMUONPedestal.cxx
index 5abbc0b7bc154349049ad6cdf2164fb9fa1f673a..e1f36440e58dbead65680edf57b44c779eb5f830 100644 (file)
 /// \author Alberto Baldisseri, JL Charvet (05/05/2009)
 //-----------------------------------------------------------------------------
 
+using std::ostream;
+using std::ifstream;
+using std::endl;
+using std::cout;
+using std::ios;
 /// \cond CLASSIMP
 ClassImp(AliMUONPedestal)
 /// \endcond
@@ -61,6 +66,7 @@ fNManu(0),
 fNManuConfig(0),
 fConfig(1),
 fStatusDA(0),
+fHistos(0),
 fErrorBuspatchTable(new AliMUON2DMap(kFALSE)),
 fManuBuspatchTable(new AliMUON2DMap(kFALSE)),
 fManuBPoutofconfigTable(new AliMUON2DMap(kFALSE)),
@@ -70,7 +76,9 @@ fHistoFileName(),
 fPedestalStore(new AliMUON2DMap(kTRUE)),
 fIndex(-1),
 fPrefixDA(),
-fPrefixLDC()
+fPrefixLDC(),
+fHistoFile(0),
+fTree(0)
 {
 /// Default constructor
 }
@@ -88,6 +96,7 @@ fNManu(0),
 fNManuConfig(0),
 fConfig(1),
 fStatusDA(0),
+fHistos(0),
 fErrorBuspatchTable(0),
 fManuBuspatchTable(0),
 fManuBPoutofconfigTable(0),
@@ -97,7 +106,9 @@ fHistoFileName(),
 fPedestalStore(0),
 fIndex(-1),
 fPrefixDA(),
-fPrefixLDC()
+fPrefixLDC(),
+fHistoFile(0),
+fTree(0)
 {
 /// Root IO constructor
 }
@@ -155,11 +166,29 @@ void AliMUONPedestal::LoadConfig(const char* dbfile)
 //______________________________________________________________________________
 void AliMUONPedestal::MakePed(Int_t busPatchId, Int_t manuId, Int_t channelId, Int_t charge)
 {
+  static Int_t tree_charge=0;
   static Int_t warn=0;
+  Int_t DDL= busPatchId/100+2560;
   /// Compute pedestals values
   AliMUONVCalibParam* ped = 
     static_cast<AliMUONVCalibParam*>(fPedestalStore ->FindObject(busPatchId, manuId));
 
+
+  if(!tree_charge && fHistos==2)
+    {
+      fTree = new TTree("tc","Charge tree");
+      fTree->Branch("bp",&busPatchId,"bp/I");
+      fTree->Branch("manu",&manuId,",manu/I");
+      fTree->Branch("channel",&channelId,",channel/I");
+      fTree->Branch("DDL",&DDL,",DDL/I");
+      fTree->Branch("charge",&charge,"charge/I");
+      //      fTree->Branch("Pedestal",&Pedestal,"Pedestal/D");
+      //      fTree->Branch("chargetrue",&chargeminusPed,"chargetrue/D");
+      //      fTree->Branch("evt",&evt,"evt/I");
+      tree_charge=1;
+    }
+
+
   if (!ped)   
     {
       if(fConfig) 
@@ -186,6 +215,8 @@ void AliMUONPedestal::MakePed(Int_t busPatchId, Int_t manuId, Int_t channelId, I
     }
   if (ped->ValueAsDouble(channelId, 1) == -1) ped->SetValueAsDouble(channelId, 1, 0.);
 
+  if(fHistos==2) fTree->Fill();  
+
   Double_t pedMean  = ped->ValueAsDouble(channelId, 0) + (Double_t) charge;
   Double_t pedSigma = ped->ValueAsDouble(channelId, 1) + (Double_t) charge*charge;
 
@@ -441,6 +472,13 @@ void AliMUONPedestal::MakeASCIIoutput(ostream& out) const
     }
 }
 
+//______________________________________________________________________________
+void AliMUONPedestal::CreateControlHistos()
+{
+// Create histo 
+  fHistoFileName=Form("%s.root",fPrefixDA.Data());
+  fHistoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals");
+}
 //______________________________________________________________________________
 void AliMUONPedestal::MakeControlHistos()
 {
@@ -453,29 +491,31 @@ void AliMUONPedestal::MakeControlHistos()
   Int_t busPatchId;
   Int_t manuId;
   Int_t channelId;
+  Int_t DDL;
 
 // histo
-  TFile*  histoFile = 0;
+//  TFile*  histoFile = 0;
   TTree* tree = 0;
   TH1F* pedMeanHisto = 0;
   TH1F* pedSigmaHisto = 0;
     
-  fHistoFileName=Form("%s.root",fPrefixDA.Data());
-  histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals");
+  //  fHistoFileName=Form("%s.root",fPrefixDA.Data());
+  //  histoFile = new TFile(fHistoFileName,"RECREATE","MUON Tracking pedestals");
 
   Int_t nx = ADCMax()+1;
   Int_t xmin = 0;
   Int_t xmax = ADCMax(); 
   pedMeanHisto = new TH1F("pedmean_allch","Pedestal mean all channels",nx,xmin,xmax);
-  pedMeanHisto->SetDirectory(histoFile);
+  pedMeanHisto->SetDirectory(fHistoFile);
 
   nx = 201;
   xmin = 0;
   xmax = 200; 
   pedSigmaHisto = new TH1F("pedsigma_allch","Pedestal sigma all channels",nx,xmin,xmax);
-  pedSigmaHisto->SetDirectory(histoFile);
+  pedSigmaHisto->SetDirectory(fHistoFile);
 
   tree = new TTree("t","Pedestal tree");
+  tree->Branch("DDL",&DDL,",DDL/I");
   tree->Branch("bp",&busPatchId,"bp/I");
   tree->Branch("manu",&manuId,",manu/I");
   tree->Branch("channel",&channelId,",channel/I");
@@ -492,6 +532,7 @@ void AliMUONPedestal::MakeControlHistos()
   {
     busPatchId = ped->ID0();
     manuId = ped->ID1();
+    DDL= busPatchId/100+2560;
     
     for ( channelId = 0; channelId < ped->Size(); ++channelId ) 
     {
@@ -506,7 +547,7 @@ void AliMUONPedestal::MakeControlHistos()
     }
   }
     
-  histoFile->Write();  
-  histoFile->Close(); 
+  fHistoFile->Write();  
+  fHistoFile->Close(); 
 
 }