ROOT logo
#if !defined(__CINT__) || defined(__MAKECINT__)
#include "TString.h"
#include "TH1.h"
#include "TH2.h"
#include "TFile.h"
#include "TList.h"
#include "TChain.h"
#include "TObject.h"
#include "TCanvas.h"
#include "TStyle.h"
#include "TSystem.h"
#include "Riostream.h"

#include "AliITSgeomTGeo.h"
#include "AliLog.h"
#include "AliRawReaderRoot.h"
#include "AliITSRawStreamSSD.h"
#include "AliCDBManager.h"
#include "AliCDBEntry.h"
#endif

/*  $Id:  $    */

//============================================================//
static const Int_t fgkNumOfChips = 6;      //number of SSD chips per module per side
static const Int_t fgkNumOfLDCs = 8;      //number of SSD LDCs
static const Int_t fgkNumOfDDLs = 16;      //number of SSD DDLs
static const Int_t fgkSSDMODULES = 1698;      //total number of SSD modules
static const Int_t fgkSSDLADDERSLAYER5 = 34; //ladders on layer 5
static const Int_t fgkSSDLADDERSLAYER6 = 38; //ladders on layer 6
static const Int_t fgkSSDMODULESPERLADDERLAYER5 = 22; //modules per ladder - layer 5                           
static const Int_t fgkSSDMODULESPERLADDERLAYER6 = 25; //modules per ladder - layer 6                          
static const Int_t fgkSSDMODULESLAYER5 = 748; //total number of SSD modules - layer5                           
static const Int_t fgkSSDMODULESLAYER6 = 950; //total number of SSD modules - layer6                         
static const Int_t fgkNumberOfPSideStrips = 768; //number of P-side strips
//============================================================//

TList *initCM();
void makeCM(const char* filename, Int_t nEvents, TList *list);
void checkCM(const char* filename);
void compareChipLists(TString inputFile1, 
		      TString inputFile2, 
		      TString outputTxt);

//__________________________________________________________//
void readSSDCommonMode(const char* filename = "raw.root",
		       Int_t nEvents = -1) {
  //Reads the CM pseudo-channels and produces the CM map for both layers 
  //and for p and n-side.
  gStyle->SetPalette(1,0);

  TList *list = initCM();
  //list->ls();
  Printf("CM histograms: %d",list->GetEntries());
  makeCM(filename,nEvents,list);
} 
 
//__________________________________________________________//
TList *initCM() {
  //Initializes the histograms and returns the TList object
  TList *list = new TList();

  Int_t gLayer = 0,gLadder = 0, gModule = 0;
  Int_t gHistCounter = 0;
  TString gTitle;
  TH1F *gHistSSDCMModule[2*fgkSSDMODULES][fgkNumOfChips]; 
  for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
    AliITSgeomTGeo::GetModuleId(iModule,gLayer,gLadder,gModule);
    for(Int_t iChip = 0; iChip < fgkNumOfChips; iChip++) {
      gTitle = "SSD_CM_PSide_Layer"; gTitle += gLayer;
      gTitle += "_Ladder"; gTitle += gLadder;
      gTitle += "_Module"; gTitle += gModule;
      gTitle += "_Chip"; gTitle += iChip+1;
      gHistSSDCMModule[gHistCounter][iChip] = new TH1F(gTitle.Data(),
						       gTitle.Data(),
						       100,-50.,50.);
      gHistSSDCMModule[gHistCounter][iChip]->GetXaxis()->SetTitle("CM");
      list->Add(gHistSSDCMModule[gHistCounter][iChip]);
    }
    gHistCounter += 1;
  }
  for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
    AliITSgeomTGeo::GetModuleId(iModule,gLayer,gLadder,gModule);
    for(Int_t iChip = 0; iChip < fgkNumOfChips; iChip++) {
      gTitle = "SSD_CM_NSide_Layer"; gTitle += gLayer;
      gTitle += "_Ladder"; gTitle += gLadder;
      gTitle += "_Module"; gTitle += gModule;
      gTitle += "_Chip"; gTitle += iChip+1;
      gHistSSDCMModule[gHistCounter][iChip] = new TH1F(gTitle.Data(),
						       gTitle.Data(),
						       100,-50.,50.);
    gHistSSDCMModule[gHistCounter][iChip]->GetXaxis()->SetTitle("CM");
    list->Add(gHistSSDCMModule[gHistCounter][iChip]);
    }
    gHistCounter += 1;
  }

  return list;
}

//__________________________________________________________//
void makeCM(const char* filename, Int_t nEvents, TList *list) {
  //Function to read the CM values
  Int_t gStripNumber = 0;
  Int_t gLayer = 0,gLadder = 0, gModule = 0;
  
  //==================================================//
  AliCDBManager *fCDBManager = AliCDBManager::Instance();
  fCDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  Int_t runNumber = atoi(gSystem->Getenv("DATE_RUN_NUMBER"));
  if(!runNumber) 
    Printf("DATE_RUN_NUMBER not defined!!!\n");
  
  fCDBManager->SetRun(runNumber);
  AliCDBEntry *geomGRP = fCDBManager->Get("GRP/Geometry/Data");
  if(!geomGRP) cout<<"GRP geometry not found!!!"<<endl;;
  //==================================================//
    
  //==================================================//
  TH2F *fHistPSideMeanCMMapLayer5 = new TH2F("fHistPSideMeanCMMapLayer5",
					 "Layer 5 - P side;N_{module};N_{ladder}",
					 22,1,23,
					 34,500,534);
  fHistPSideMeanCMMapLayer5->GetXaxis()->SetTitleColor(1);
  fHistPSideMeanCMMapLayer5->GetZaxis()->SetRangeUser(0.,20.);
  fHistPSideMeanCMMapLayer5->SetStats(kFALSE);
  fHistPSideMeanCMMapLayer5->GetYaxis()->SetTitleOffset(1.8);
  fHistPSideMeanCMMapLayer5->GetXaxis()->SetNdivisions(22);
  fHistPSideMeanCMMapLayer5->GetYaxis()->SetNdivisions(34);
  fHistPSideMeanCMMapLayer5->GetXaxis()->SetLabelSize(0.03);
  fHistPSideMeanCMMapLayer5->GetYaxis()->SetLabelSize(0.03);
  fHistPSideMeanCMMapLayer5->GetZaxis()->SetTitleOffset(1.6);
  fHistPSideMeanCMMapLayer5->GetZaxis()->SetTitle("RMS(CM) (p-side)");

  TH2F *fHistNSideMeanCMMapLayer5 = new TH2F("fHistNSideMeanCMMapLayer5",
					 "Layer 5 - N side;N_{module};N_{ladder}",
					 22,1,23,
					 34,500,534);
  fHistNSideMeanCMMapLayer5->GetXaxis()->SetTitleColor(1);
  fHistNSideMeanCMMapLayer5->GetZaxis()->SetRangeUser(0.,20.);
  fHistNSideMeanCMMapLayer5->SetStats(kFALSE);
  fHistNSideMeanCMMapLayer5->GetYaxis()->SetTitleOffset(1.8);
  fHistNSideMeanCMMapLayer5->GetXaxis()->SetNdivisions(22);
  fHistNSideMeanCMMapLayer5->GetYaxis()->SetNdivisions(34);
  fHistNSideMeanCMMapLayer5->GetXaxis()->SetLabelSize(0.03);
  fHistNSideMeanCMMapLayer5->GetYaxis()->SetLabelSize(0.03);
  fHistNSideMeanCMMapLayer5->GetZaxis()->SetTitleOffset(1.6);
  fHistNSideMeanCMMapLayer5->GetZaxis()->SetTitle("RMS(CM) (n-side)");
  
  TH2F *fHistPSideMeanCMMapLayer6 = new TH2F("fHistPSideMeanCMMapLayer6",
					 "Layer 6 - P side;N_{module};N_{ladder}",
					 25,1,26,
					 38,600,638);
  fHistPSideMeanCMMapLayer6->GetXaxis()->SetTitleColor(1);
  fHistPSideMeanCMMapLayer6->GetZaxis()->SetRangeUser(0.,20.);
  fHistPSideMeanCMMapLayer6->SetStats(kFALSE);
  fHistPSideMeanCMMapLayer6->GetYaxis()->SetTitleOffset(1.8);
  fHistPSideMeanCMMapLayer6->GetXaxis()->SetNdivisions(25);
  fHistPSideMeanCMMapLayer6->GetYaxis()->SetNdivisions(38);
  fHistPSideMeanCMMapLayer6->GetXaxis()->SetLabelSize(0.03);
  fHistPSideMeanCMMapLayer6->GetYaxis()->SetLabelSize(0.03);
  fHistPSideMeanCMMapLayer6->GetZaxis()->SetTitleOffset(1.6);
  fHistPSideMeanCMMapLayer6->GetZaxis()->SetTitle("RMS(CM) (p-side)");

  TH2F *fHistNSideMeanCMMapLayer6 = new TH2F("fHistNSideMeanCMMapLayer6",
					 "Layer 6 - N side;N_{module};N_{ladder}",
					 25,1,26,
					 38,600,638);
  fHistNSideMeanCMMapLayer6->GetXaxis()->SetTitleColor(1);
  fHistNSideMeanCMMapLayer6->GetZaxis()->SetRangeUser(0.,20.);
  fHistNSideMeanCMMapLayer6->SetStats(kFALSE);
  fHistNSideMeanCMMapLayer6->GetYaxis()->SetTitleOffset(1.8);
  fHistNSideMeanCMMapLayer6->GetXaxis()->SetNdivisions(25);
  fHistNSideMeanCMMapLayer6->GetYaxis()->SetNdivisions(38);
  fHistNSideMeanCMMapLayer6->GetXaxis()->SetLabelSize(0.03);
  fHistNSideMeanCMMapLayer6->GetYaxis()->SetLabelSize(0.03);
  fHistNSideMeanCMMapLayer6->GetZaxis()->SetTitleOffset(1.6);
  fHistNSideMeanCMMapLayer6->GetZaxis()->SetTitle("RMS(CM) (n-side)");

  //____________________________________________________________//
  TH2F *fHistPSideRMSCMMapLayer5 = new TH2F("fHistPSideRMSCMMapLayer5",
					 "Layer 5 - P side;N_{module};N_{ladder}",
					 22,1,23,
					 34,500,534);
  fHistPSideRMSCMMapLayer5->GetXaxis()->SetTitleColor(1);
  fHistPSideRMSCMMapLayer5->GetZaxis()->SetRangeUser(0.,20.);
  fHistPSideRMSCMMapLayer5->SetStats(kFALSE);
  fHistPSideRMSCMMapLayer5->GetYaxis()->SetTitleOffset(1.8);
  fHistPSideRMSCMMapLayer5->GetXaxis()->SetNdivisions(22);
  fHistPSideRMSCMMapLayer5->GetYaxis()->SetNdivisions(34);
  fHistPSideRMSCMMapLayer5->GetXaxis()->SetLabelSize(0.03);
  fHistPSideRMSCMMapLayer5->GetYaxis()->SetLabelSize(0.03);
  fHistPSideRMSCMMapLayer5->GetZaxis()->SetTitleOffset(1.6);
  fHistPSideRMSCMMapLayer5->GetZaxis()->SetTitle("RMS(CM) (p-side)");

  TH2F *fHistNSideRMSCMMapLayer5 = new TH2F("fHistNSideRMSCMMapLayer5",
					 "Layer 5 - N side;N_{module};N_{ladder}",
					 22,1,23,
					 34,500,534);
  fHistNSideRMSCMMapLayer5->GetXaxis()->SetTitleColor(1);
  fHistNSideRMSCMMapLayer5->GetZaxis()->SetRangeUser(0.,20.);
  fHistNSideRMSCMMapLayer5->SetStats(kFALSE);
  fHistNSideRMSCMMapLayer5->GetYaxis()->SetTitleOffset(1.8);
  fHistNSideRMSCMMapLayer5->GetXaxis()->SetNdivisions(22);
  fHistNSideRMSCMMapLayer5->GetYaxis()->SetNdivisions(34);
  fHistNSideRMSCMMapLayer5->GetXaxis()->SetLabelSize(0.03);
  fHistNSideRMSCMMapLayer5->GetYaxis()->SetLabelSize(0.03);
  fHistNSideRMSCMMapLayer5->GetZaxis()->SetTitleOffset(1.6);
  fHistNSideRMSCMMapLayer5->GetZaxis()->SetTitle("RMS(CM) (n-side)");
  
  TH2F *fHistPSideRMSCMMapLayer6 = new TH2F("fHistPSideRMSCMMapLayer6",
					 "Layer 6 - P side;N_{module};N_{ladder}",
					 25,1,26,
					 38,600,638);
  fHistPSideRMSCMMapLayer6->GetXaxis()->SetTitleColor(1);
  fHistPSideRMSCMMapLayer6->GetZaxis()->SetRangeUser(0.,20.);
  fHistPSideRMSCMMapLayer6->SetStats(kFALSE);
  fHistPSideRMSCMMapLayer6->GetYaxis()->SetTitleOffset(1.8);
  fHistPSideRMSCMMapLayer6->GetXaxis()->SetNdivisions(25);
  fHistPSideRMSCMMapLayer6->GetYaxis()->SetNdivisions(38);
  fHistPSideRMSCMMapLayer6->GetXaxis()->SetLabelSize(0.03);
  fHistPSideRMSCMMapLayer6->GetYaxis()->SetLabelSize(0.03);
  fHistPSideRMSCMMapLayer6->GetZaxis()->SetTitleOffset(1.6);
  fHistPSideRMSCMMapLayer6->GetZaxis()->SetTitle("RMS(CM) (p-side)");

  TH2F *fHistNSideRMSCMMapLayer6 = new TH2F("fHistNSideRMSCMMapLayer6",
					 "Layer 6 - N side;N_{module};N_{ladder}",
					 25,1,26,
					 38,600,638);
  fHistNSideRMSCMMapLayer6->GetXaxis()->SetTitleColor(1);
  fHistNSideRMSCMMapLayer6->GetZaxis()->SetRangeUser(0.,20.);
  fHistNSideRMSCMMapLayer6->SetStats(kFALSE);
  fHistNSideRMSCMMapLayer6->GetYaxis()->SetTitleOffset(1.8);
  fHistNSideRMSCMMapLayer6->GetXaxis()->SetNdivisions(25);
  fHistNSideRMSCMMapLayer6->GetYaxis()->SetNdivisions(38);
  fHistNSideRMSCMMapLayer6->GetXaxis()->SetLabelSize(0.03);
  fHistNSideRMSCMMapLayer6->GetYaxis()->SetLabelSize(0.03);
  fHistNSideRMSCMMapLayer6->GetZaxis()->SetTitleOffset(1.6);
  fHistNSideRMSCMMapLayer6->GetZaxis()->SetTitle("RMS(CM) (n-side)");
  //==================================================//

  TChain *chain = new TChain("RAW");
  chain->Add(filename);
  Int_t nTotalEvents = chain->GetEntries();
  if(nEvents == -1) nEvents = nTotalEvents;
  
  AliRawReaderRoot *rawReader = new AliRawReaderRoot(filename);
  Int_t iEvent = 0;
  Int_t fSSDEvent = 0;
  for(iEvent = 0; iEvent < nEvents; iEvent++) {
    cout<<"Event: "<<iEvent+1<<"/"<<nEvents<<endl;
    rawReader->Select("ITSSSD",-1,-1);  
    rawReader->Reset(); 
    rawReader->NextEvent();   
    
    if(rawReader->GetType() != 7) continue;
    
    fSSDEvent += 1;
    AliITSRawStreamSSD gSSDStream(rawReader);    
    while (gSSDStream.Next()) {
      if(gSSDStream.GetModuleID() < 0) continue;
      AliITSgeomTGeo::GetModuleId(gSSDStream.GetModuleID(),gLayer,gLadder,gModule);
      //if(gSSDStream.GetModuleID() != 500) continue;
      //Printf("Module id: %d - Layer: %d - Ladder: %d - Module: %d",gSSDStream.GetModuleID(),gLayer,gLadder,gModule);

      if(gSSDStream.GetStrip() >= 0) continue;
      gStripNumber = (gSSDStream.GetSideFlag() == 0) ? gSSDStream.GetStrip() : -gSSDStream.GetStrip() + 2*fgkNumberOfPSideStrips;
      //Printf("Module id: %d - Strip: %d - strip number: %d - Signal: %lf",gSSDStream.GetModuleID(),gSSDStream.GetStrip(),gStripNumber,signal);
      if(TMath::Abs(gSSDStream.GetStrip()) < 7)
	((TH1*)list->At((gSSDStream.GetModuleID()-500)*fgkNumOfChips+gSSDStream.GetStrip()))->Fill(gSSDStream.GetSignal());
      if(TMath::Abs(gSSDStream.GetStrip()) > 6)
	((TH1*)list->At(fgkSSDMODULES*fgkNumOfChips+(gSSDStream.GetModuleID()-500)*fgkNumOfChips+gSSDStream.GetStrip()))->Fill(gSSDStream.GetSignal());
    }//streamer loop
  }//event loop
  
  //compute the rms of the CM values
  TH1F *gHistCMDummy = new TH1F("gHistCMDummy","",100,-50.,50.);
  Double_t meanPsideCM = 0.0, meanNsideCM = 0.0;
  Double_t rmsPsideCM = 0.0, rmsNsideCM = 0.0;
  for(Int_t iModule = 0; iModule < fgkSSDMODULES; iModule++) {
      meanPsideCM = 0.0; meanNsideCM = 0.0;
    rmsPsideCM = 0.0; rmsNsideCM = 0.0;
    AliITSgeomTGeo::GetModuleId(iModule+500,gLayer,gLadder,gModule);
  
    gHistCMDummy->Clear();
    for(Int_t iChip = 0; iChip < fgkNumOfChips; iChip++) {
      //cout<<"Name: "<<dynamic_cast<TH1*>(list->At(iModule*fgkNumOfChips+iChip))->GetName()<<endl;
      gHistCMDummy->Add((TH1*)list->At(iModule*fgkNumOfChips+iChip));
    } 
    meanPsideCM = TMath::Abs(gHistCMDummy->GetMean());
    rmsPsideCM = gHistCMDummy->GetRMS();

    gHistCMDummy->Clear();
    for(Int_t iChip = 0; iChip < fgkNumOfChips; iChip++) {
      //cout<<"Name: "<<dynamic_cast<TH1*>(list->At(fgkSSDMODULES*fgkNumOfChips+iModule*fgkNumOfChips+iChip))->GetName()<<endl;
      gHistCMDummy->Add((TH1*)list->At(fgkSSDMODULES*fgkNumOfChips+iModule*fgkNumOfChips+iChip));
    }
    meanNsideCM = TMath::Abs(gHistCMDummy->GetMean());
    rmsNsideCM = gHistCMDummy->GetRMS();

    if(meanPsideCM == 0) meanPsideCM = 0.001;
    if(meanNsideCM == 0) meanNsideCM = 0.001;
    if(rmsPsideCM == 0) rmsPsideCM = 0.001;
    if(rmsNsideCM == 0) rmsNsideCM = 0.001;
 
    if(gLayer == 5) {
      fHistPSideMeanCMMapLayer5->SetBinContent(gModule,gLadder,meanPsideCM);
      fHistNSideMeanCMMapLayer5->SetBinContent(gModule,gLadder,meanNsideCM);
      fHistPSideRMSCMMapLayer5->SetBinContent(gModule,gLadder,rmsPsideCM);
      fHistNSideRMSCMMapLayer5->SetBinContent(gModule,gLadder,rmsNsideCM);
    }
     if(gLayer == 6) {
      fHistPSideMeanCMMapLayer6->SetBinContent(gModule,gLadder,meanPsideCM);
      fHistNSideMeanCMMapLayer6->SetBinContent(gModule,gLadder,meanNsideCM);
      fHistPSideRMSCMMapLayer6->SetBinContent(gModule,gLadder,rmsPsideCM);
      fHistNSideRMSCMMapLayer6->SetBinContent(gModule,gLadder,rmsNsideCM);
    }
    }

  TFile *foutput = TFile::Open("SSD.CM.root","recreate");
  list->Write();
  fHistPSideMeanCMMapLayer5->Write(); fHistNSideMeanCMMapLayer5->Write();
  fHistPSideMeanCMMapLayer6->Write(); fHistNSideMeanCMMapLayer6->Write();
  fHistPSideRMSCMMapLayer5->Write(); fHistNSideRMSCMMapLayer5->Write();
  fHistPSideRMSCMMapLayer6->Write(); fHistNSideRMSCMMapLayer6->Write();
  foutput->Close();
}
  
//__________________________________________________________//
void drawSSDCM(const char* filename = "SSD.CM.root") {
  gStyle->SetPalette(1,0);

  TFile *f = TFile::Open(filename);  

  TCanvas *c1 = new TCanvas("c1","Mean of CM values",0,0,700,650);
  c1->SetFillColor(10); c1->SetHighLightColor(10); c1->Divide(2,2);
  c1->cd(1);
  TH2F *fHistPSideMeanCMMapLayer5 = dynamic_cast<TH2F *>(f->Get("fHistPSideMeanCMMapLayer5"));
  fHistPSideMeanCMMapLayer5->Draw("colz");
  c1->cd(2);
  TH2F *fHistNSideMeanCMMapLayer5 = dynamic_cast<TH2F *>(f->Get("fHistNSideMeanCMMapLayer5"));
  fHistNSideMeanCMMapLayer5->Draw("colz");
  c1->cd(3);
  TH2F *fHistPSideMeanCMMapLayer6 = dynamic_cast<TH2F *>(f->Get("fHistPSideMeanCMMapLayer6"));
  fHistPSideMeanCMMapLayer6->Draw("colz");
  c1->cd(4);
  TH2F *fHistNSideMeanCMMapLayer6 = dynamic_cast<TH2F *>(f->Get("fHistNSideMeanCMMapLayer6"));
  fHistNSideMeanCMMapLayer6->Draw("colz");

  TCanvas *c2 = new TCanvas("c2","RMS of CM values",100,100,700,650);
  c2->SetFillColor(10); c2->SetHighLightColor(10); c2->Divide(2,2);
  c2->cd(1);
  TH2F *fHistPSideRMSCMMapLayer5 = dynamic_cast<TH2F *>(f->Get("fHistPSideRMSCMMapLayer5"));
  fHistPSideRMSCMMapLayer5->Draw("colz");
  c2->cd(2);
  TH2F *fHistNSideRMSCMMapLayer5 = dynamic_cast<TH2F *>(f->Get("fHistNSideRMSCMMapLayer5"));
  fHistNSideRMSCMMapLayer5->Draw("colz");
  c2->cd(3);
  TH2F *fHistPSideRMSCMMapLayer6 = dynamic_cast<TH2F *>(f->Get("fHistPSideRMSCMMapLayer6"));
  fHistPSideRMSCMMapLayer6->Draw("colz");
  c2->cd(4);
  TH2F *fHistNSideRMSCMMapLayer6 = dynamic_cast<TH2F *>(f->Get("fHistNSideRMSCMMapLayer6"));
  fHistNSideRMSCMMapLayer6->Draw("colz");
}

//__________________________________________________________//
void checkCM(const char* filename) {
  //Reads the SSD.CM.root file as an input.
  //For every chip checks the mean and the rms of the CM distributions.
  //If the absolute value of the mean is beyond 5 ADC counts or/and the 
  //rms is beyond 10, the corresponding histogram is added to the list 
  //of suspicious chips. This list is written to the output file having 
  //the name: SSD.FaultyChips.root

  //Hardcoded check values
  const Double_t meanMax = 5.;
  const Double_t rmsMax = 10.;

  //output list
  TList *listOfSuspiciousChips = new TList();

  //Input file
  TFile *fInput = TFile::Open(filename);

  Int_t gLayer = 0,gLadder = 0, gModule = 0;
  TString gTitle;
  //Double_t meanValue = 0.0, rmsValue = 0.0;
  TH1F *gHistSSDCMModule = 0x0;
  //P-side
  for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
    AliITSgeomTGeo::GetModuleId(iModule,gLayer,gLadder,gModule);
    for(Int_t iChip = 0; iChip < fgkNumOfChips; iChip++) {
      gTitle = "SSD_CM_PSide_Layer"; gTitle += gLayer;
      gTitle += "_Ladder"; gTitle += gLadder;
      gTitle += "_Module"; gTitle += gModule;
      gTitle += "_Chip"; gTitle += iChip+1;
      gHistSSDCMModule = dynamic_cast<TH1F *>(fInput->Get(gTitle.Data()));
      if((TMath::Abs(gHistSSDCMModule->GetMean(1)) > meanMax)||
	 (TMath::Abs(gHistSSDCMModule->GetRMS(1)) > rmsMax)) {
	Printf("Name: %s, Mean: %lf - rms: %lf",
	       gHistSSDCMModule->GetName(),
	       TMath::Abs(gHistSSDCMModule->GetMean(1)),
	       TMath::Abs(gHistSSDCMModule->GetRMS(1)));
	listOfSuspiciousChips->Add(gHistSSDCMModule);
      }
    }//chip loop
  }//module loop

  //N-side
  for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
    AliITSgeomTGeo::GetModuleId(iModule,gLayer,gLadder,gModule);
    for(Int_t iChip = 0; iChip < fgkNumOfChips; iChip++) {
      gTitle = "SSD_CM_NSide_Layer"; gTitle += gLayer;
      gTitle += "_Ladder"; gTitle += gLadder;
      gTitle += "_Module"; gTitle += gModule;
      gTitle += "_Chip"; gTitle += iChip+1;
      gHistSSDCMModule = dynamic_cast<TH1F *>(fInput->Get(gTitle.Data()));
      if((TMath::Abs(gHistSSDCMModule->GetMean(1)) > meanMax)||
	 (TMath::Abs(gHistSSDCMModule->GetRMS(1)) > rmsMax)) {
	Printf("Name: %s, Mean: %lf - rms: %lf",
	       gHistSSDCMModule->GetName(),
	       TMath::Abs(gHistSSDCMModule->GetMean(1)),
	       TMath::Abs(gHistSSDCMModule->GetRMS(1)));
	listOfSuspiciousChips->Add(gHistSSDCMModule);
      }
      //Printf("Name: %s",gHistSSDCMModule->GetName());
    }//chip loop
  }//module loop

  Printf("===============================================");
  Printf("%d suspicious chips were put in the list",
	 listOfSuspiciousChips->GetEntries());
  Printf("===============================================");
  TFile *fOutput = new TFile("SSD.FaultyChips.root","recreate");
  listOfSuspiciousChips->Write();
  fOutput->Close();

  fInput->Close();
}

//__________________________________________________________//
void compareChipLists(TString inputFile1, 
		      TString inputFile2, 
		      TString outputTxt){
  //Compare two different lists of chips and put those present in both files
  //in a new list
  //open input lists
  TFile *fInput1 = TFile::Open(inputFile1.Data());
  TList *listOfSuspiciousChips1 = new TList();
  listOfSuspiciousChips1=fInput1->GetListOfKeys();
  TFile *fInput2 = TFile::Open(inputFile2.Data());
  TList *listOfSuspiciousChips2 = new TList();
  listOfSuspiciousChips2=fInput2->GetListOfKeys();
	
  Int_t Nentries1 = 0, Nentries2 = 0, k = 0;
  Nentries1 = listOfSuspiciousChips1->GetEntries();
  Nentries2 = listOfSuspiciousChips2->GetEntries();
	
  //create new list
  TList *listOfRecurrentChips = new TList();
  TString Name1;
	
  for(Int_t i=0; i<Nentries1; i++){
    TH1F *h1 = dynamic_cast <TH1F*>(fInput1->Get(listOfSuspiciousChips1->At(i)->GetName()));
    for(Int_t j=0; j<Nentries2; j++){
      TH1F *h2 = dynamic_cast <TH1F*>(fInput2->Get(listOfSuspiciousChips2->At(j)->GetName()));
      Name1=h1->GetName();
      if (!Name1.CompareTo(h2->GetName())) {
	cout << Name1.CompareTo(h2->GetName()) << 
	  "   " << h2->GetName() << endl;
	k++;
	listOfRecurrentChips->Add(h1);
      }
    }//second file loop
  }//first file loop
  
  Printf("%i Faulty chips in the first file", Nentries1);
  Printf("%i Faulty chips in the second file", Nentries2);
  Printf("%i Recurrent Faulty chips", k+1);	
  
  TString outputFile = "SSD.RecurrentFaultyChips."; outputFile += outputTxt;
  outputFile += ".root";
  
  TFile *fOutput = new TFile(outputFile.Data(),"recreate");
  listOfRecurrentChips->Write();
  fOutput->Close();
  
  fInput1->Close();
  fInput2->Close();
}

//__________________________________________________________//
void makeCM2D(const char* filename, Int_t nEvents) {
  //Function to read the CM values
  gStyle->SetPalette(1,0);
  Int_t gStripNumber = 0;
  Int_t gLayer = 0,gLadder = 0, gModule = 0;
  
  //==================================================//
  AliCDBManager *fCDBManager = AliCDBManager::Instance();
  fCDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
  Int_t runNumber = atoi(gSystem->Getenv("DATE_RUN_NUMBER"));
  if(!runNumber) 
    Printf("DATE_RUN_NUMBER not defined!!!\n");
  
  fCDBManager->SetRun(runNumber);
  AliCDBEntry *geomGRP = fCDBManager->Get("GRP/Geometry/Data");
  if(!geomGRP) cout<<"GRP geometry not found!!!"<<endl;;
  //==================================================//
    
  //==================================================//
  TList *list = new TList();
  TH2F *gHistCM2D[fgkSSDMODULES];
  TString gHistoTitle, gArrayTitle;
  Int_t gHistCounter = 0;
  for(Int_t iModule = 500; iModule < fgkSSDMODULES + 500; iModule++) {
    AliITSgeomTGeo::GetModuleId(iModule,gLayer,gLadder,gModule);    
    gHistoTitle = "SSD_CM_Layer"; gHistoTitle += gLayer;
    gHistoTitle += "_Ladder"; gHistoTitle += gLadder;
    gHistoTitle += "_Module"; gHistoTitle += gModule;
    //Printf("Title: %s",gHistoTitle.Data());
    gHistCM2D[gHistCounter] = new TH2F(gHistoTitle.Data(),
				       gHistoTitle.Data(),
				       12,0.5,12.5,
				       120,-60.,60.);
    gHistCM2D[gHistCounter]->SetStats(kFALSE);
    gHistCM2D[gHistCounter]->GetXaxis()->SetTitleColor(1);
    gHistCM2D[gHistCounter]->GetZaxis()->SetTitle("Entries");
    gHistCM2D[gHistCounter]->GetYaxis()->SetTitle("CM");
    gHistCM2D[gHistCounter]->GetXaxis()->SetTitle("Chip number");
    gHistCM2D[gHistCounter]->GetXaxis()->SetNdivisions(12);
    list->Add(gHistCM2D[gHistCounter]);
    gHistCounter += 1;
  }
  //Printf("List entries: %d",list->GetEntries());
  //==================================================//

  TChain *chain = new TChain("RAW");
  chain->Add(filename);
  Int_t nTotalEvents = chain->GetEntries();
  if(nEvents == -1) nEvents = nTotalEvents;
  
  AliRawReaderRoot *rawReader = new AliRawReaderRoot(filename);
  Int_t iEvent = 0;
  Int_t fSSDEvent = 0;
  for(iEvent = 0; iEvent < nEvents; iEvent++) {
    cout<<"Event: "<<iEvent+1<<"/"<<nEvents<<endl;
    rawReader->Select("ITSSSD",-1,-1);  
    rawReader->Reset(); 
    rawReader->NextEvent();   
    
    if(rawReader->GetType() != 7) continue;
    
    fSSDEvent += 1;
    AliITSRawStreamSSD gSSDStream(rawReader);    
    while (gSSDStream.Next()) {
      if(gSSDStream.GetModuleID() < 0) continue;
      AliITSgeomTGeo::GetModuleId(gSSDStream.GetModuleID(),gLayer,gLadder,gModule);
      //if(gSSDStream.GetModuleID() != 500) continue;
      //Printf("Module id: %d - Layer: %d - Ladder: %d - Module: %d",gSSDStream.GetModuleID(),gLayer,gLadder,gModule);

      if(gSSDStream.GetStrip() >= 0) continue;
      gStripNumber = (gSSDStream.GetSideFlag() == 0) ? gSSDStream.GetStrip() : -gSSDStream.GetStrip() + 2*fgkNumberOfPSideStrips;
      //Printf("Module id: %d - Strip: %d - strip number: %d - Signal: %lf",gSSDStream.GetModuleID(),gSSDStream.GetStrip(),gStripNumber,gSSDStream.GetSignal());
      gHistCM2D[gSSDStream.GetModuleID()-500]->Fill(TMath::Abs(gSSDStream.GetStrip()),gSSDStream.GetSignal());      
    }//streamer loop
  }//event loop
  
  TCanvas *cLayer5[34];
  TCanvas *cLayer6[38];
  TString canvasTitle;
  for(Int_t iLadder = 1; iLadder < 35; iLadder++) {
    canvasTitle = "SSD_CM_Layer5_Ladder"; canvasTitle += iLadder;
    cLayer5[iLadder-1] = new TCanvas(canvasTitle.Data(),
				     canvasTitle.Data());
    cLayer5[iLadder-1]->Divide(5,5);    
    for(Int_t iModule = 1; iModule < 23; iModule++) {
      cLayer5[iLadder-1]->cd(iModule);
      gHistCM2D[(iLadder-1)*fgkSSDMODULESPERLADDERLAYER5 + iModule - 1]->Draw("colz");
    }
    if(iLadder == 1) cLayer5[iLadder-1]->Print("CommonModePlotsLayer5.ps(");
    if(iLadder == 34) cLayer5[iLadder-1]->Print("CommonModePlotsLayer5.ps)");
    else cLayer5[iLadder-1]->Print("CommonModePlotsLayer5.ps");
    //Printf("Ladder %d finished...",499+iLadder);
  }

  for(Int_t iLadder = 1; iLadder < 39; iLadder++) {
    canvasTitle = "SSD_CM_Layer6_Ladder"; canvasTitle += iLadder;
    cLayer6[iLadder-1] = new TCanvas(canvasTitle.Data(),
				     canvasTitle.Data());
    cLayer6[iLadder-1]->Divide(5,5);    
    for(Int_t iModule = 1; iModule < 26; iModule++) {
      cLayer6[iLadder-1]->cd(iModule);
      gHistCM2D[fgkSSDMODULESLAYER5 + (iLadder-1)*fgkSSDMODULESPERLADDERLAYER6 + iModule - 1]->Draw("colz");
    }
    if(iLadder == 1) cLayer6[iLadder-1]->Print("CommonModePlotsLayer6.ps(");
    if(iLadder == 38) cLayer6[iLadder-1]->Print("CommonModePlotsLayer6.ps)");
    else cLayer6[iLadder-1]->Print("CommonModePlotsLayer6.ps");
    //Printf("Ladder %d finished...",599+iLadder);
  }


  TFile *foutput = TFile::Open("SSD.CM2D.root","recreate");
  list->Write();
  foutput->Close();
}
 
 readSSDCommonMode.C:1
 readSSDCommonMode.C:2
 readSSDCommonMode.C:3
 readSSDCommonMode.C:4
 readSSDCommonMode.C:5
 readSSDCommonMode.C:6
 readSSDCommonMode.C:7
 readSSDCommonMode.C:8
 readSSDCommonMode.C:9
 readSSDCommonMode.C:10
 readSSDCommonMode.C:11
 readSSDCommonMode.C:12
 readSSDCommonMode.C:13
 readSSDCommonMode.C:14
 readSSDCommonMode.C:15
 readSSDCommonMode.C:16
 readSSDCommonMode.C:17
 readSSDCommonMode.C:18
 readSSDCommonMode.C:19
 readSSDCommonMode.C:20
 readSSDCommonMode.C:21
 readSSDCommonMode.C:22
 readSSDCommonMode.C:23
 readSSDCommonMode.C:24
 readSSDCommonMode.C:25
 readSSDCommonMode.C:26
 readSSDCommonMode.C:27
 readSSDCommonMode.C:28
 readSSDCommonMode.C:29
 readSSDCommonMode.C:30
 readSSDCommonMode.C:31
 readSSDCommonMode.C:32
 readSSDCommonMode.C:33
 readSSDCommonMode.C:34
 readSSDCommonMode.C:35
 readSSDCommonMode.C:36
 readSSDCommonMode.C:37
 readSSDCommonMode.C:38
 readSSDCommonMode.C:39
 readSSDCommonMode.C:40
 readSSDCommonMode.C:41
 readSSDCommonMode.C:42
 readSSDCommonMode.C:43
 readSSDCommonMode.C:44
 readSSDCommonMode.C:45
 readSSDCommonMode.C:46
 readSSDCommonMode.C:47
 readSSDCommonMode.C:48
 readSSDCommonMode.C:49
 readSSDCommonMode.C:50
 readSSDCommonMode.C:51
 readSSDCommonMode.C:52
 readSSDCommonMode.C:53
 readSSDCommonMode.C:54
 readSSDCommonMode.C:55
 readSSDCommonMode.C:56
 readSSDCommonMode.C:57
 readSSDCommonMode.C:58
 readSSDCommonMode.C:59
 readSSDCommonMode.C:60
 readSSDCommonMode.C:61
 readSSDCommonMode.C:62
 readSSDCommonMode.C:63
 readSSDCommonMode.C:64
 readSSDCommonMode.C:65
 readSSDCommonMode.C:66
 readSSDCommonMode.C:67
 readSSDCommonMode.C:68
 readSSDCommonMode.C:69
 readSSDCommonMode.C:70
 readSSDCommonMode.C:71
 readSSDCommonMode.C:72
 readSSDCommonMode.C:73
 readSSDCommonMode.C:74
 readSSDCommonMode.C:75
 readSSDCommonMode.C:76
 readSSDCommonMode.C:77
 readSSDCommonMode.C:78
 readSSDCommonMode.C:79
 readSSDCommonMode.C:80
 readSSDCommonMode.C:81
 readSSDCommonMode.C:82
 readSSDCommonMode.C:83
 readSSDCommonMode.C:84
 readSSDCommonMode.C:85
 readSSDCommonMode.C:86
 readSSDCommonMode.C:87
 readSSDCommonMode.C:88
 readSSDCommonMode.C:89
 readSSDCommonMode.C:90
 readSSDCommonMode.C:91
 readSSDCommonMode.C:92
 readSSDCommonMode.C:93
 readSSDCommonMode.C:94
 readSSDCommonMode.C:95
 readSSDCommonMode.C:96
 readSSDCommonMode.C:97
 readSSDCommonMode.C:98
 readSSDCommonMode.C:99
 readSSDCommonMode.C:100
 readSSDCommonMode.C:101
 readSSDCommonMode.C:102
 readSSDCommonMode.C:103
 readSSDCommonMode.C:104
 readSSDCommonMode.C:105
 readSSDCommonMode.C:106
 readSSDCommonMode.C:107
 readSSDCommonMode.C:108
 readSSDCommonMode.C:109
 readSSDCommonMode.C:110
 readSSDCommonMode.C:111
 readSSDCommonMode.C:112
 readSSDCommonMode.C:113
 readSSDCommonMode.C:114
 readSSDCommonMode.C:115
 readSSDCommonMode.C:116
 readSSDCommonMode.C:117
 readSSDCommonMode.C:118
 readSSDCommonMode.C:119
 readSSDCommonMode.C:120
 readSSDCommonMode.C:121
 readSSDCommonMode.C:122
 readSSDCommonMode.C:123
 readSSDCommonMode.C:124
 readSSDCommonMode.C:125
 readSSDCommonMode.C:126
 readSSDCommonMode.C:127
 readSSDCommonMode.C:128
 readSSDCommonMode.C:129
 readSSDCommonMode.C:130
 readSSDCommonMode.C:131
 readSSDCommonMode.C:132
 readSSDCommonMode.C:133
 readSSDCommonMode.C:134
 readSSDCommonMode.C:135
 readSSDCommonMode.C:136
 readSSDCommonMode.C:137
 readSSDCommonMode.C:138
 readSSDCommonMode.C:139
 readSSDCommonMode.C:140
 readSSDCommonMode.C:141
 readSSDCommonMode.C:142
 readSSDCommonMode.C:143
 readSSDCommonMode.C:144
 readSSDCommonMode.C:145
 readSSDCommonMode.C:146
 readSSDCommonMode.C:147
 readSSDCommonMode.C:148
 readSSDCommonMode.C:149
 readSSDCommonMode.C:150
 readSSDCommonMode.C:151
 readSSDCommonMode.C:152
 readSSDCommonMode.C:153
 readSSDCommonMode.C:154
 readSSDCommonMode.C:155
 readSSDCommonMode.C:156
 readSSDCommonMode.C:157
 readSSDCommonMode.C:158
 readSSDCommonMode.C:159
 readSSDCommonMode.C:160
 readSSDCommonMode.C:161
 readSSDCommonMode.C:162
 readSSDCommonMode.C:163
 readSSDCommonMode.C:164
 readSSDCommonMode.C:165
 readSSDCommonMode.C:166
 readSSDCommonMode.C:167
 readSSDCommonMode.C:168
 readSSDCommonMode.C:169
 readSSDCommonMode.C:170
 readSSDCommonMode.C:171
 readSSDCommonMode.C:172
 readSSDCommonMode.C:173
 readSSDCommonMode.C:174
 readSSDCommonMode.C:175
 readSSDCommonMode.C:176
 readSSDCommonMode.C:177
 readSSDCommonMode.C:178
 readSSDCommonMode.C:179
 readSSDCommonMode.C:180
 readSSDCommonMode.C:181
 readSSDCommonMode.C:182
 readSSDCommonMode.C:183
 readSSDCommonMode.C:184
 readSSDCommonMode.C:185
 readSSDCommonMode.C:186
 readSSDCommonMode.C:187
 readSSDCommonMode.C:188
 readSSDCommonMode.C:189
 readSSDCommonMode.C:190
 readSSDCommonMode.C:191
 readSSDCommonMode.C:192
 readSSDCommonMode.C:193
 readSSDCommonMode.C:194
 readSSDCommonMode.C:195
 readSSDCommonMode.C:196
 readSSDCommonMode.C:197
 readSSDCommonMode.C:198
 readSSDCommonMode.C:199
 readSSDCommonMode.C:200
 readSSDCommonMode.C:201
 readSSDCommonMode.C:202
 readSSDCommonMode.C:203
 readSSDCommonMode.C:204
 readSSDCommonMode.C:205
 readSSDCommonMode.C:206
 readSSDCommonMode.C:207
 readSSDCommonMode.C:208
 readSSDCommonMode.C:209
 readSSDCommonMode.C:210
 readSSDCommonMode.C:211
 readSSDCommonMode.C:212
 readSSDCommonMode.C:213
 readSSDCommonMode.C:214
 readSSDCommonMode.C:215
 readSSDCommonMode.C:216
 readSSDCommonMode.C:217
 readSSDCommonMode.C:218
 readSSDCommonMode.C:219
 readSSDCommonMode.C:220
 readSSDCommonMode.C:221
 readSSDCommonMode.C:222
 readSSDCommonMode.C:223
 readSSDCommonMode.C:224
 readSSDCommonMode.C:225
 readSSDCommonMode.C:226
 readSSDCommonMode.C:227
 readSSDCommonMode.C:228
 readSSDCommonMode.C:229
 readSSDCommonMode.C:230
 readSSDCommonMode.C:231
 readSSDCommonMode.C:232
 readSSDCommonMode.C:233
 readSSDCommonMode.C:234
 readSSDCommonMode.C:235
 readSSDCommonMode.C:236
 readSSDCommonMode.C:237
 readSSDCommonMode.C:238
 readSSDCommonMode.C:239
 readSSDCommonMode.C:240
 readSSDCommonMode.C:241
 readSSDCommonMode.C:242
 readSSDCommonMode.C:243
 readSSDCommonMode.C:244
 readSSDCommonMode.C:245
 readSSDCommonMode.C:246
 readSSDCommonMode.C:247
 readSSDCommonMode.C:248
 readSSDCommonMode.C:249
 readSSDCommonMode.C:250
 readSSDCommonMode.C:251
 readSSDCommonMode.C:252
 readSSDCommonMode.C:253
 readSSDCommonMode.C:254
 readSSDCommonMode.C:255
 readSSDCommonMode.C:256
 readSSDCommonMode.C:257
 readSSDCommonMode.C:258
 readSSDCommonMode.C:259
 readSSDCommonMode.C:260
 readSSDCommonMode.C:261
 readSSDCommonMode.C:262
 readSSDCommonMode.C:263
 readSSDCommonMode.C:264
 readSSDCommonMode.C:265
 readSSDCommonMode.C:266
 readSSDCommonMode.C:267
 readSSDCommonMode.C:268
 readSSDCommonMode.C:269
 readSSDCommonMode.C:270
 readSSDCommonMode.C:271
 readSSDCommonMode.C:272
 readSSDCommonMode.C:273
 readSSDCommonMode.C:274
 readSSDCommonMode.C:275
 readSSDCommonMode.C:276
 readSSDCommonMode.C:277
 readSSDCommonMode.C:278
 readSSDCommonMode.C:279
 readSSDCommonMode.C:280
 readSSDCommonMode.C:281
 readSSDCommonMode.C:282
 readSSDCommonMode.C:283
 readSSDCommonMode.C:284
 readSSDCommonMode.C:285
 readSSDCommonMode.C:286
 readSSDCommonMode.C:287
 readSSDCommonMode.C:288
 readSSDCommonMode.C:289
 readSSDCommonMode.C:290
 readSSDCommonMode.C:291
 readSSDCommonMode.C:292
 readSSDCommonMode.C:293
 readSSDCommonMode.C:294
 readSSDCommonMode.C:295
 readSSDCommonMode.C:296
 readSSDCommonMode.C:297
 readSSDCommonMode.C:298
 readSSDCommonMode.C:299
 readSSDCommonMode.C:300
 readSSDCommonMode.C:301
 readSSDCommonMode.C:302
 readSSDCommonMode.C:303
 readSSDCommonMode.C:304
 readSSDCommonMode.C:305
 readSSDCommonMode.C:306
 readSSDCommonMode.C:307
 readSSDCommonMode.C:308
 readSSDCommonMode.C:309
 readSSDCommonMode.C:310
 readSSDCommonMode.C:311
 readSSDCommonMode.C:312
 readSSDCommonMode.C:313
 readSSDCommonMode.C:314
 readSSDCommonMode.C:315
 readSSDCommonMode.C:316
 readSSDCommonMode.C:317
 readSSDCommonMode.C:318
 readSSDCommonMode.C:319
 readSSDCommonMode.C:320
 readSSDCommonMode.C:321
 readSSDCommonMode.C:322
 readSSDCommonMode.C:323
 readSSDCommonMode.C:324
 readSSDCommonMode.C:325
 readSSDCommonMode.C:326
 readSSDCommonMode.C:327
 readSSDCommonMode.C:328
 readSSDCommonMode.C:329
 readSSDCommonMode.C:330
 readSSDCommonMode.C:331
 readSSDCommonMode.C:332
 readSSDCommonMode.C:333
 readSSDCommonMode.C:334
 readSSDCommonMode.C:335
 readSSDCommonMode.C:336
 readSSDCommonMode.C:337
 readSSDCommonMode.C:338
 readSSDCommonMode.C:339
 readSSDCommonMode.C:340
 readSSDCommonMode.C:341
 readSSDCommonMode.C:342
 readSSDCommonMode.C:343
 readSSDCommonMode.C:344
 readSSDCommonMode.C:345
 readSSDCommonMode.C:346
 readSSDCommonMode.C:347
 readSSDCommonMode.C:348
 readSSDCommonMode.C:349
 readSSDCommonMode.C:350
 readSSDCommonMode.C:351
 readSSDCommonMode.C:352
 readSSDCommonMode.C:353
 readSSDCommonMode.C:354
 readSSDCommonMode.C:355
 readSSDCommonMode.C:356
 readSSDCommonMode.C:357
 readSSDCommonMode.C:358
 readSSDCommonMode.C:359
 readSSDCommonMode.C:360
 readSSDCommonMode.C:361
 readSSDCommonMode.C:362
 readSSDCommonMode.C:363
 readSSDCommonMode.C:364
 readSSDCommonMode.C:365
 readSSDCommonMode.C:366
 readSSDCommonMode.C:367
 readSSDCommonMode.C:368
 readSSDCommonMode.C:369
 readSSDCommonMode.C:370
 readSSDCommonMode.C:371
 readSSDCommonMode.C:372
 readSSDCommonMode.C:373
 readSSDCommonMode.C:374
 readSSDCommonMode.C:375
 readSSDCommonMode.C:376
 readSSDCommonMode.C:377
 readSSDCommonMode.C:378
 readSSDCommonMode.C:379
 readSSDCommonMode.C:380
 readSSDCommonMode.C:381
 readSSDCommonMode.C:382
 readSSDCommonMode.C:383
 readSSDCommonMode.C:384
 readSSDCommonMode.C:385
 readSSDCommonMode.C:386
 readSSDCommonMode.C:387
 readSSDCommonMode.C:388
 readSSDCommonMode.C:389
 readSSDCommonMode.C:390
 readSSDCommonMode.C:391
 readSSDCommonMode.C:392
 readSSDCommonMode.C:393
 readSSDCommonMode.C:394
 readSSDCommonMode.C:395
 readSSDCommonMode.C:396
 readSSDCommonMode.C:397
 readSSDCommonMode.C:398
 readSSDCommonMode.C:399
 readSSDCommonMode.C:400
 readSSDCommonMode.C:401
 readSSDCommonMode.C:402
 readSSDCommonMode.C:403
 readSSDCommonMode.C:404
 readSSDCommonMode.C:405
 readSSDCommonMode.C:406
 readSSDCommonMode.C:407
 readSSDCommonMode.C:408
 readSSDCommonMode.C:409
 readSSDCommonMode.C:410
 readSSDCommonMode.C:411
 readSSDCommonMode.C:412
 readSSDCommonMode.C:413
 readSSDCommonMode.C:414
 readSSDCommonMode.C:415
 readSSDCommonMode.C:416
 readSSDCommonMode.C:417
 readSSDCommonMode.C:418
 readSSDCommonMode.C:419
 readSSDCommonMode.C:420
 readSSDCommonMode.C:421
 readSSDCommonMode.C:422
 readSSDCommonMode.C:423
 readSSDCommonMode.C:424
 readSSDCommonMode.C:425
 readSSDCommonMode.C:426
 readSSDCommonMode.C:427
 readSSDCommonMode.C:428
 readSSDCommonMode.C:429
 readSSDCommonMode.C:430
 readSSDCommonMode.C:431
 readSSDCommonMode.C:432
 readSSDCommonMode.C:433
 readSSDCommonMode.C:434
 readSSDCommonMode.C:435
 readSSDCommonMode.C:436
 readSSDCommonMode.C:437
 readSSDCommonMode.C:438
 readSSDCommonMode.C:439
 readSSDCommonMode.C:440
 readSSDCommonMode.C:441
 readSSDCommonMode.C:442
 readSSDCommonMode.C:443
 readSSDCommonMode.C:444
 readSSDCommonMode.C:445
 readSSDCommonMode.C:446
 readSSDCommonMode.C:447
 readSSDCommonMode.C:448
 readSSDCommonMode.C:449
 readSSDCommonMode.C:450
 readSSDCommonMode.C:451
 readSSDCommonMode.C:452
 readSSDCommonMode.C:453
 readSSDCommonMode.C:454
 readSSDCommonMode.C:455
 readSSDCommonMode.C:456
 readSSDCommonMode.C:457
 readSSDCommonMode.C:458
 readSSDCommonMode.C:459
 readSSDCommonMode.C:460
 readSSDCommonMode.C:461
 readSSDCommonMode.C:462
 readSSDCommonMode.C:463
 readSSDCommonMode.C:464
 readSSDCommonMode.C:465
 readSSDCommonMode.C:466
 readSSDCommonMode.C:467
 readSSDCommonMode.C:468
 readSSDCommonMode.C:469
 readSSDCommonMode.C:470
 readSSDCommonMode.C:471
 readSSDCommonMode.C:472
 readSSDCommonMode.C:473
 readSSDCommonMode.C:474
 readSSDCommonMode.C:475
 readSSDCommonMode.C:476
 readSSDCommonMode.C:477
 readSSDCommonMode.C:478
 readSSDCommonMode.C:479
 readSSDCommonMode.C:480
 readSSDCommonMode.C:481
 readSSDCommonMode.C:482
 readSSDCommonMode.C:483
 readSSDCommonMode.C:484
 readSSDCommonMode.C:485
 readSSDCommonMode.C:486
 readSSDCommonMode.C:487
 readSSDCommonMode.C:488
 readSSDCommonMode.C:489
 readSSDCommonMode.C:490
 readSSDCommonMode.C:491
 readSSDCommonMode.C:492
 readSSDCommonMode.C:493
 readSSDCommonMode.C:494
 readSSDCommonMode.C:495
 readSSDCommonMode.C:496
 readSSDCommonMode.C:497
 readSSDCommonMode.C:498
 readSSDCommonMode.C:499
 readSSDCommonMode.C:500
 readSSDCommonMode.C:501
 readSSDCommonMode.C:502
 readSSDCommonMode.C:503
 readSSDCommonMode.C:504
 readSSDCommonMode.C:505
 readSSDCommonMode.C:506
 readSSDCommonMode.C:507
 readSSDCommonMode.C:508
 readSSDCommonMode.C:509
 readSSDCommonMode.C:510
 readSSDCommonMode.C:511
 readSSDCommonMode.C:512
 readSSDCommonMode.C:513
 readSSDCommonMode.C:514
 readSSDCommonMode.C:515
 readSSDCommonMode.C:516
 readSSDCommonMode.C:517
 readSSDCommonMode.C:518
 readSSDCommonMode.C:519
 readSSDCommonMode.C:520
 readSSDCommonMode.C:521
 readSSDCommonMode.C:522
 readSSDCommonMode.C:523
 readSSDCommonMode.C:524
 readSSDCommonMode.C:525
 readSSDCommonMode.C:526
 readSSDCommonMode.C:527
 readSSDCommonMode.C:528
 readSSDCommonMode.C:529
 readSSDCommonMode.C:530
 readSSDCommonMode.C:531
 readSSDCommonMode.C:532
 readSSDCommonMode.C:533
 readSSDCommonMode.C:534
 readSSDCommonMode.C:535
 readSSDCommonMode.C:536
 readSSDCommonMode.C:537
 readSSDCommonMode.C:538
 readSSDCommonMode.C:539
 readSSDCommonMode.C:540
 readSSDCommonMode.C:541
 readSSDCommonMode.C:542
 readSSDCommonMode.C:543
 readSSDCommonMode.C:544
 readSSDCommonMode.C:545
 readSSDCommonMode.C:546
 readSSDCommonMode.C:547
 readSSDCommonMode.C:548
 readSSDCommonMode.C:549
 readSSDCommonMode.C:550
 readSSDCommonMode.C:551
 readSSDCommonMode.C:552
 readSSDCommonMode.C:553
 readSSDCommonMode.C:554
 readSSDCommonMode.C:555
 readSSDCommonMode.C:556
 readSSDCommonMode.C:557
 readSSDCommonMode.C:558
 readSSDCommonMode.C:559
 readSSDCommonMode.C:560
 readSSDCommonMode.C:561
 readSSDCommonMode.C:562
 readSSDCommonMode.C:563
 readSSDCommonMode.C:564
 readSSDCommonMode.C:565
 readSSDCommonMode.C:566
 readSSDCommonMode.C:567
 readSSDCommonMode.C:568
 readSSDCommonMode.C:569
 readSSDCommonMode.C:570
 readSSDCommonMode.C:571
 readSSDCommonMode.C:572
 readSSDCommonMode.C:573
 readSSDCommonMode.C:574
 readSSDCommonMode.C:575
 readSSDCommonMode.C:576
 readSSDCommonMode.C:577
 readSSDCommonMode.C:578
 readSSDCommonMode.C:579
 readSSDCommonMode.C:580
 readSSDCommonMode.C:581
 readSSDCommonMode.C:582
 readSSDCommonMode.C:583
 readSSDCommonMode.C:584
 readSSDCommonMode.C:585
 readSSDCommonMode.C:586
 readSSDCommonMode.C:587
 readSSDCommonMode.C:588
 readSSDCommonMode.C:589
 readSSDCommonMode.C:590
 readSSDCommonMode.C:591
 readSSDCommonMode.C:592
 readSSDCommonMode.C:593
 readSSDCommonMode.C:594
 readSSDCommonMode.C:595
 readSSDCommonMode.C:596
 readSSDCommonMode.C:597
 readSSDCommonMode.C:598
 readSSDCommonMode.C:599
 readSSDCommonMode.C:600
 readSSDCommonMode.C:601
 readSSDCommonMode.C:602
 readSSDCommonMode.C:603
 readSSDCommonMode.C:604
 readSSDCommonMode.C:605
 readSSDCommonMode.C:606
 readSSDCommonMode.C:607
 readSSDCommonMode.C:608